Package org.jfree.xml.util
Class GenericObjectFactory
java.lang.Object
org.jfree.xml.util.GenericObjectFactory
The generic object factory contains all methods necessary to collect
the property values needed to produce a fully instantiated object.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AttributeDefinition[]
Storage for the attribute definitions.private final Class
The base class.private final ConstructorDefinition[]
Storage for the constructor definitions.private final LookupDefinition[]
Storage for the lookup definitions.private final String[]
The ordered property names.private final PropertyDefinition[]
Storage for the property definitions.private final HashMap
Storage for property info.private final HashMap
Storage for property values.private final String
The register name. -
Constructor Summary
ConstructorsModifierConstructorDescriptionGenericObjectFactory
(Class c, String registerName, ConstructorDefinition[] constructors, PropertyDefinition[] propertyDefinitions, LookupDefinition[] lookupDefinitions, AttributeDefinition[] attributeDefinitions, String[] orderedPropertyNames) Creates a new generic object factory.private
GenericObjectFactory
(GenericObjectFactory factory) A copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionCreates an object according to the definition.Returns the attribute definitions.Returns the base class.Returns the constructor definitions.Returns a copy of this instance.Returns the lookup definitions.String[]
Returns the property names.getProperty
(String name) Returns the value of the specified property.getPropertyDefinitionByPropertyName
(String propertyName) Returns the property definition for the specified property name.getPropertyDefinitionByTagName
(String tagName) Returns a property definition for the specified tag name.Returns the property definitions.private PropertyDescriptor
getPropertyDescriptor
(String propertyName) Returns a property descriptor.Returns the register name.getTypeForTagName
(String tagName) Returns the class for a tag name.private boolean
isAssignableOrPrimitive
(Class baseType, Class valueType) Returnstrue
if the base type is a primitive or assignable from the value type.private boolean
isConstructorProperty
(String propertyName) Returnstrue
if the specified property is...boolean
isPropertyDefinition
(String propertyName) Returns true if there is a property definition for the specified property name.void
readProperties
(Object object) Reads the properties.void
setProperty
(String propertyName, Object value) Sets a property value.void
writeObjectProperties
(Object object) Writes the properties for the object.
-
Field Details
-
constructorDefinitions
Storage for the constructor definitions. -
propertyDefinitions
Storage for the property definitions. -
lookupDefinitions
Storage for the lookup definitions. -
attributeDefinitions
Storage for the attribute definitions. -
orderedPropertyNames
The ordered property names. -
propertyInfos
Storage for property info. -
propertyValues
Storage for property values. -
baseClass
The base class. -
registerName
The register name.
-
-
Constructor Details
-
GenericObjectFactory
public GenericObjectFactory(Class c, String registerName, ConstructorDefinition[] constructors, PropertyDefinition[] propertyDefinitions, LookupDefinition[] lookupDefinitions, AttributeDefinition[] attributeDefinitions, String[] orderedPropertyNames) throws ObjectDescriptionException Creates a new generic object factory.- Parameters:
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.- Throws:
ObjectDescriptionException
- if there is a problem.
-
GenericObjectFactory
A copy constructor.- Parameters:
factory
- the factory to copy.
-
-
Method Details
-
getInstance
Returns a copy of this instance.- Returns:
- a copy of this instance.
-
getRegisterName
Returns the register name.- Returns:
- the register name.
-
getPropertyDescriptor
Returns a property descriptor.- Parameters:
propertyName
- the property name.- Returns:
- a property descriptor.
-
getTypeForTagName
Returns the class for a tag name.- Parameters:
tagName
- the tag name.- Returns:
- the class.
- Throws:
ObjectDescriptionException
- if there is a problem.
-
isPropertyDefinition
Returns true if there is a property definition for the specified property name.- Parameters:
propertyName
- the property name.- Returns:
- A boolean.
-
getPropertyDefinitionByPropertyName
public PropertyDefinition getPropertyDefinitionByPropertyName(String propertyName) throws ObjectDescriptionException Returns the property definition for the specified property name.- Parameters:
propertyName
- the property name.- Returns:
- the property definition.
- Throws:
ObjectDescriptionException
- if there is no such property for this object.
-
getPropertyDefinitionByTagName
public PropertyDefinition getPropertyDefinitionByTagName(String tagName) throws ObjectDescriptionException Returns a property definition for the specified tag name.- Parameters:
tagName
- the tag name.- Returns:
- the property definition.
- Throws:
ObjectDescriptionException
- if there is no such tag defined for this object.
-
getConstructorDefinitions
Returns the constructor definitions.- Returns:
- the constructor definitions.
-
getAttributeDefinitions
Returns the attribute definitions.- Returns:
- the attribute definitions.
-
getPropertyDefinitions
Returns the property definitions.- Returns:
- the property definitions.
-
getOrderedPropertyNames
Returns the property names.- Returns:
- the property names.
-
getLookupDefinitions
Returns the lookup definitions.- Returns:
- the lookup definitions.
-
getProperty
Returns the value of the specified property.- Parameters:
name
- the property name.- Returns:
- the property value.
-
createObject
Creates an object according to the definition.- Returns:
- the object.
- Throws:
ObjectDescriptionException
- if there is a problem with the object description.
-
setProperty
Sets a property value.- Parameters:
propertyName
- the property name.value
- the property value.- Throws:
ObjectDescriptionException
- if there is a problem with the object description.
-
isAssignableOrPrimitive
Returnstrue
if the base type is a primitive or assignable from the value type.- Parameters:
baseType
- the base class.valueType
- the value class.- Returns:
- A boolean.
-
isConstructorProperty
Returnstrue
if the specified property is...- Parameters:
propertyName
- the property name.- Returns:
- A boolean.
-
writeObjectProperties
Writes the properties for the object.- Parameters:
object
- the object.- Throws:
ObjectDescriptionException
- if there is a problem.
-
readProperties
Reads the properties.- Parameters:
object
- the object.- Throws:
ObjectDescriptionException
- if there is a problem.
-
getBaseClass
Returns the base class.- Returns:
- the base class.
-