com.abra.j2xb.beans.model
Class MOBeanDescriptor

java.lang.Object
  extended by com.abra.j2xb.beans.model.MOBeanDescriptor
Direct Known Subclasses:
MOPersistentBeanDescriptor

public class MOBeanDescriptor
extends java.lang.Object

Defines the metadata for a mapped Bean. The class supports a special case for mapping exceptions. The special case adds the message property of the exception and optionally adds the exception trace.

Since:
JDK1.5
Version:
1.0, May 1, 2008
Author:
Yoav Abrahami

Constructor Summary
MOBeanDescriptor(MOBeansFactory factory, java.lang.Class<?> clazz)
           
MOBeanDescriptor(MOBeansFactory factory, java.lang.Class<?> clazz, MOAbstractPropertyDescriptor parentProperty)
           
 
Method Summary
 java.lang.Class<?> getBeanClass()
           
 MOBeansFactory getBeansFactory()
           
 java.util.List<MOChoicePropertyDescriptor> getChoiceProperties()
           
 MOConstructorFacade getConstructorFacade()
           
 java.util.List<MODelegateDescriptor> getDelegates()
           
 java.beans.PropertyDescriptor getJavaPropertyDescriptor(java.lang.String propertyPath)
          finds a Java property in the bean class
 MOPropertyDescriptor getMOPropertyDescriptor(java.lang.String propertyPath)
           
protected  MOPropertyDescriptor getMOPropertyDescriptor(java.lang.String[] path, java.lang.String propertyPath, int positionInPath)
           
 MOAbstractPropertyDescriptor getParentProperty()
           
 java.util.List<MOPropertyDescriptor> getProperties()
           
 MOPropertyDescriptor getPropertyByName(java.lang.String propertyName)
          finds a property by name.
 MOPersistentBeanDescriptor getSuperclassBeanDescriptor()
           
 java.lang.Class<?> getType(java.lang.String propertyPath)
          this method supports getting property type from delegates also
 java.lang.Object getValue(java.lang.Object instance, java.lang.String propertyPath)
          this method supports getting values from delegates also
 java.lang.String getXmlName()
           
protected  void introspectBean()
          introspect the bean to create the property mappings
static boolean isNonMappedThrowable(java.lang.Class<?> clazz)
           
 boolean isPersistentBean()
           
static boolean isPersistentBean(java.lang.Class<?> clazz)
           
 boolean isPersistentDependentBean()
           
static boolean isPersistentDependentBean(java.lang.Class<?> clazz)
           
static boolean isThrowable(java.lang.Class<?> clazz)
           
 void setValue(java.lang.Object instance, java.lang.Object value, java.lang.String propertyPath)
          this method supports getting values from delegates also
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MOBeanDescriptor

public MOBeanDescriptor(MOBeansFactory factory,
                        java.lang.Class<?> clazz,
                        MOAbstractPropertyDescriptor parentProperty)
                 throws MOBeansException
Throws:
MOBeansException

MOBeanDescriptor

public MOBeanDescriptor(MOBeansFactory factory,
                        java.lang.Class<?> clazz)
                 throws MOBeansException
Throws:
MOBeansException
Method Detail

isPersistentBean

public boolean isPersistentBean()

isPersistentDependentBean

public boolean isPersistentDependentBean()

isPersistentBean

public static boolean isPersistentBean(java.lang.Class<?> clazz)

isThrowable

public static boolean isThrowable(java.lang.Class<?> clazz)

isNonMappedThrowable

public static boolean isNonMappedThrowable(java.lang.Class<?> clazz)

isPersistentDependentBean

public static boolean isPersistentDependentBean(java.lang.Class<?> clazz)

introspectBean

protected void introspectBean()
                       throws MOBeansException
introspect the bean to create the property mappings

Throws:
MOBeansException - if the annotations on the bean are invalid.

getConstructorFacade

public MOConstructorFacade getConstructorFacade()

getPropertyByName

public MOPropertyDescriptor getPropertyByName(java.lang.String propertyName)
finds a property by name. This method finds only direct properties, not delegate properties

Parameters:
propertyName - the Java name of the property to search for
Returns:
the property descriptor, or null the property was not found.

getProperties

public java.util.List<MOPropertyDescriptor> getProperties()

getDelegates

public java.util.List<MODelegateDescriptor> getDelegates()

getChoiceProperties

public java.util.List<MOChoicePropertyDescriptor> getChoiceProperties()

getBeanClass

public java.lang.Class<?> getBeanClass()

getXmlName

public java.lang.String getXmlName()

getParentProperty

public MOAbstractPropertyDescriptor getParentProperty()

getMOPropertyDescriptor

public MOPropertyDescriptor getMOPropertyDescriptor(java.lang.String propertyPath)
                                             throws MOBeansPropertyNotFoundException
Throws:
MOBeansPropertyNotFoundException

getMOPropertyDescriptor

protected MOPropertyDescriptor getMOPropertyDescriptor(java.lang.String[] path,
                                                       java.lang.String propertyPath,
                                                       int positionInPath)
                                                throws MOBeansPropertyNotFoundException
Throws:
MOBeansPropertyNotFoundException

getType

public java.lang.Class<?> getType(java.lang.String propertyPath)
                           throws MOBeansException
this method supports getting property type from delegates also

Parameters:
propertyPath - a dot separated path to the property to be set (e.g. address.name)
Returns:
the property type
Throws:
MOBeansException

getValue

public java.lang.Object getValue(java.lang.Object instance,
                                 java.lang.String propertyPath)
                          throws MOBeansException
this method supports getting values from delegates also

Parameters:
propertyPath - a dot separated path to the property to be set
instance - the instance to set the value for
Returns:
the property value
Throws:
MOBeansException

setValue

public void setValue(java.lang.Object instance,
                     java.lang.Object value,
                     java.lang.String propertyPath)
              throws MOBeansException
this method supports getting values from delegates also

Parameters:
propertyPath - - a path to the property to get the value for
value - the value to set
Throws:
MOBeansException

getJavaPropertyDescriptor

public java.beans.PropertyDescriptor getJavaPropertyDescriptor(java.lang.String propertyPath)
                                                        throws MOBeansPropertyAccessException
finds a Java property in the bean class

Parameters:
propertyPath - - a path to the property to search for
Returns:
the Property Descriptor, if one is found, or else null
Throws:
MOBeansPropertyAccessException

getBeansFactory

public MOBeansFactory getBeansFactory()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getSuperclassBeanDescriptor

public MOPersistentBeanDescriptor getSuperclassBeanDescriptor()


Copyright © 2008. All Rights Reserved.