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 PropertiesThe handler mapping.private static ModelBuilderThe single instance. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds attribute handlers.buildModel(SourceCollector c, DescriptionModel model) Builds a model from the classes provided by theSourceCollector.private booleanChecks, whether the classcis contained in the given class array.private ClassDescriptioncreateClassDescription(BeanInfo beanInfo, ClassDescription parent) Creates aClassDescriptionobject for the specified bean info.Creates aPropertyInfoobject from aPropertyDescriptor.private Class[]fillModel(Class[] classes, DescriptionModel model) Updates the model to contain the given classes.private voidfillSuperClasses(DescriptionModel model) Fills the super class for all object descriptions of the model.private Class[]findElementTypes(DescriptionModel model) private StringReturns the class name for the attribute handler for a property of the specified class.static ModelBuilderReturns the single instance of this class.private booleanChecks, whether the given class can be handled as attribute.static booleanisValidMethod(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
DescriptionGeneratorclass invokes this.- Parameters:
c- the source collector.model- the model under construction (nullpermitted).- 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 aClassDescriptionobject 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 aPropertyInfoobject from aPropertyDescriptor.- Parameters:
pd- the property descriptor.- Returns:
- the property info (
nullpossible).
-
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 classcis 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.
-