Package org.jfree.xml.generator
Class ModelBuilder
java.lang.Object
org.jfree.xml.generator.ModelBuilder
A model builder. This class performs the work of creating a class description model from
a set of source files.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Properties
The handler mapping.private static ModelBuilder
The single instance. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds attribute handlers.buildModel
(SourceCollector c, DescriptionModel model) Builds a model from the classes provided by theSourceCollector
.private boolean
Checks, whether the classc
is contained in the given class array.private ClassDescription
createClassDescription
(BeanInfo beanInfo, ClassDescription parent) Creates aClassDescription
object for the specified bean info.Creates aPropertyInfo
object from aPropertyDescriptor
.private Class[]
fillModel
(Class[] classes, DescriptionModel model) Updates the model to contain the given classes.private void
fillSuperClasses
(DescriptionModel model) Fills the super class for all object descriptions of the model.private Class[]
findElementTypes
(DescriptionModel model) private String
Returns the class name for the attribute handler for a property of the specified class.static ModelBuilder
Returns the single instance of this class.private boolean
Checks, whether the given class can be handled as attribute.static boolean
isValidMethod
(Method method) Checks, whether the given method can be called from the generic object factory.
-
Field Details
-
instance
The single instance. -
handlerMapping
The handler mapping.
-
-
Constructor Details
-
ModelBuilder
private ModelBuilder()Creates a single instance.
-
-
Method Details
-
getInstance
Returns the single instance of this class.- Returns:
- the single instance of this class.
-
addAttributeHandlers
Adds attribute handlers.- Parameters:
p
- the handlers.
-
buildModel
Builds a model from the classes provided by theSourceCollector
.The
DescriptionGenerator
class invokes this.- Parameters:
c
- the source collector.model
- the model under construction (null
permitted).- Returns:
- The completed model.
-
findElementTypes
-
fillSuperClasses
Fills the super class for all object descriptions of the model. The super class is only filled, if the object's super class is contained in the model.- Parameters:
model
- the model which should get its superclasses updated.
-
fillModel
Updates the model to contain the given classes.- Parameters:
classes
- a list of classes which should be part of the model.model
- the model which is updated- Returns:
- A list of super classes which should also be contained in the model.
-
createClassDescription
Creates aClassDescription
object for the specified bean info.- Parameters:
beanInfo
- the bean info.parent
- the parent class description.- Returns:
- The class description.
-
isValidMethod
Checks, whether the given method can be called from the generic object factory.- Parameters:
method
- the method descriptor- Returns:
- true, if the method is not null and public, false otherwise.
-
createSimplePropertyInfo
Creates aPropertyInfo
object from aPropertyDescriptor
.- Parameters:
pd
- the property descriptor.- Returns:
- the property info (
null
possible).
-
isAttributeProperty
Checks, whether the given class can be handled as attribute. All primitive types can be attributes as well as all types which have a custom attribute handler defined.- Parameters:
c
- the class which should be checked- Returns:
- true, if the class can be handled as attribute, false otherwise.
-
getHandlerClass
Returns the class name for the attribute handler for a property of the specified class.- Parameters:
c
- the class for which to search an attribute handler- Returns:
- the handler class or null, if this class cannot be handled as attribute.
-
contains
Checks, whether the classc
is contained in the given class array.- Parameters:
cAll
- the list of all classesc
- the class to be searched- Returns:
- true, if the class is contained in the array, false otherwise.
-