public final class GenericObjectFactory
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private AttributeDefinition[] |
attributeDefinitions
Storage for the attribute definitions.
|
private java.lang.Class |
baseClass
The base class.
|
private ConstructorDefinition[] |
constructorDefinitions
Storage for the constructor definitions.
|
private LookupDefinition[] |
lookupDefinitions
Storage for the lookup definitions.
|
private java.lang.String[] |
orderedPropertyNames
The ordered property names.
|
private PropertyDefinition[] |
propertyDefinitions
Storage for the property definitions.
|
private java.util.HashMap |
propertyInfos
Storage for property info.
|
private java.util.HashMap |
propertyValues
Storage for property values.
|
private java.lang.String |
registerName
The register name.
|
Modifier | Constructor and Description |
---|---|
|
GenericObjectFactory(java.lang.Class c,
java.lang.String registerName,
ConstructorDefinition[] constructors,
PropertyDefinition[] propertyDefinitions,
LookupDefinition[] lookupDefinitions,
AttributeDefinition[] attributeDefinitions,
java.lang.String[] orderedPropertyNames)
Creates a new generic object factory.
|
private |
GenericObjectFactory(GenericObjectFactory factory)
A copy constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
createObject()
Creates an object according to the definition.
|
AttributeDefinition[] |
getAttributeDefinitions()
Returns the attribute definitions.
|
java.lang.Class |
getBaseClass()
Returns the base class.
|
ConstructorDefinition[] |
getConstructorDefinitions()
Returns the constructor definitions.
|
GenericObjectFactory |
getInstance()
Returns a copy of this instance.
|
LookupDefinition[] |
getLookupDefinitions()
Returns the lookup definitions.
|
java.lang.String[] |
getOrderedPropertyNames()
Returns the property names.
|
java.lang.Object |
getProperty(java.lang.String name)
Returns the value of the specified property.
|
PropertyDefinition |
getPropertyDefinitionByPropertyName(java.lang.String propertyName)
Returns the property definition for the specified property name.
|
PropertyDefinition |
getPropertyDefinitionByTagName(java.lang.String tagName)
Returns a property definition for the specified tag name.
|
PropertyDefinition[] |
getPropertyDefinitions()
Returns the property definitions.
|
private java.beans.PropertyDescriptor |
getPropertyDescriptor(java.lang.String propertyName)
Returns a property descriptor.
|
java.lang.String |
getRegisterName()
Returns the register name.
|
java.lang.Class |
getTypeForTagName(java.lang.String tagName)
Returns the class for a tag name.
|
private boolean |
isAssignableOrPrimitive(java.lang.Class baseType,
java.lang.Class valueType)
Returns
true if the base type is a primitive or assignable from the value type. |
private boolean |
isConstructorProperty(java.lang.String propertyName)
Returns
true if the specified property is... |
boolean |
isPropertyDefinition(java.lang.String propertyName)
Returns true if there is a property definition for the specified property name.
|
void |
readProperties(java.lang.Object object)
Reads the properties.
|
void |
setProperty(java.lang.String propertyName,
java.lang.Object value)
Sets a property value.
|
void |
writeObjectProperties(java.lang.Object object)
Writes the properties for the object.
|
private final ConstructorDefinition[] constructorDefinitions
private final PropertyDefinition[] propertyDefinitions
private final LookupDefinition[] lookupDefinitions
private final AttributeDefinition[] attributeDefinitions
private final java.lang.String[] orderedPropertyNames
private final java.util.HashMap propertyInfos
private final java.util.HashMap propertyValues
private final java.lang.Class baseClass
private final java.lang.String registerName
public GenericObjectFactory(java.lang.Class c, java.lang.String registerName, ConstructorDefinition[] constructors, PropertyDefinition[] propertyDefinitions, LookupDefinition[] lookupDefinitions, AttributeDefinition[] attributeDefinitions, java.lang.String[] orderedPropertyNames) throws ObjectDescriptionException
c
- the class.registerName
- the (optional) name under which to register the class for
any later lookup.constructors
- the constructor definitions.propertyDefinitions
- the property definitions.lookupDefinitions
- the lookup definitions.attributeDefinitions
- the attribute definitions.orderedPropertyNames
- the ordered property names.ObjectDescriptionException
- if there is a problem.private GenericObjectFactory(GenericObjectFactory factory)
factory
- the factory to copy.public GenericObjectFactory getInstance()
public java.lang.String getRegisterName()
private java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.String propertyName)
propertyName
- the property name.public java.lang.Class getTypeForTagName(java.lang.String tagName) throws ObjectDescriptionException
tagName
- the tag name.ObjectDescriptionException
- if there is a problem.public boolean isPropertyDefinition(java.lang.String propertyName)
propertyName
- the property name.public PropertyDefinition getPropertyDefinitionByPropertyName(java.lang.String propertyName) throws ObjectDescriptionException
propertyName
- the property name.ObjectDescriptionException
- if there is no such property for this object.public PropertyDefinition getPropertyDefinitionByTagName(java.lang.String tagName) throws ObjectDescriptionException
tagName
- the tag name.ObjectDescriptionException
- if there is no such tag defined for this object.public ConstructorDefinition[] getConstructorDefinitions()
public AttributeDefinition[] getAttributeDefinitions()
public PropertyDefinition[] getPropertyDefinitions()
public java.lang.String[] getOrderedPropertyNames()
public LookupDefinition[] getLookupDefinitions()
public java.lang.Object getProperty(java.lang.String name)
name
- the property name.public java.lang.Object createObject() throws ObjectDescriptionException
ObjectDescriptionException
- if there is a problem with the object description.public void setProperty(java.lang.String propertyName, java.lang.Object value) throws ObjectDescriptionException
propertyName
- the property name.value
- the property value.ObjectDescriptionException
- if there is a problem with the object description.private boolean isAssignableOrPrimitive(java.lang.Class baseType, java.lang.Class valueType)
true
if the base type is a primitive or assignable from the value type.baseType
- the base class.valueType
- the value class.private boolean isConstructorProperty(java.lang.String propertyName)
true
if the specified property is...propertyName
- the property name.public void writeObjectProperties(java.lang.Object object) throws ObjectDescriptionException
object
- the object.ObjectDescriptionException
- if there is a problem.public void readProperties(java.lang.Object object) throws ObjectDescriptionException
object
- the object.ObjectDescriptionException
- if there is a problem.public java.lang.Class getBaseClass()