Class ModelBuilder

java.lang.Object
org.jfree.xml.generator.ModelBuilder

public final class ModelBuilder extends Object
A model builder. This class performs the work of creating a class description model from a set of source files.
  • Field Details

    • instance

      private static ModelBuilder instance
      The single instance.
    • handlerMapping

      private Properties handlerMapping
      The handler mapping.
  • Constructor Details

    • ModelBuilder

      private ModelBuilder()
      Creates a single instance.
  • Method Details

    • getInstance

      public static ModelBuilder getInstance()
      Returns the single instance of this class.
      Returns:
      the single instance of this class.
    • addAttributeHandlers

      public void addAttributeHandlers(Properties p)
      Adds attribute handlers.
      Parameters:
      p - the handlers.
    • buildModel

      public DescriptionModel buildModel(SourceCollector c, DescriptionModel model)
      Builds a model from the classes provided by the SourceCollector.

      The DescriptionGenerator class invokes this.

      Parameters:
      c - the source collector.
      model - the model under construction (null permitted).
      Returns:
      The completed model.
    • findElementTypes

      private Class[] findElementTypes(DescriptionModel model)
    • fillSuperClasses

      private void fillSuperClasses(DescriptionModel model)
      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

      private Class[] fillModel(Class[] classes, DescriptionModel model)
      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

      private ClassDescription createClassDescription(BeanInfo beanInfo, ClassDescription parent)
      Creates a ClassDescription object for the specified bean info.
      Parameters:
      beanInfo - the bean info.
      parent - the parent class description.
      Returns:
      The class description.
    • isValidMethod

      public static boolean isValidMethod(Method method)
      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

      public PropertyInfo createSimplePropertyInfo(PropertyDescriptor pd)
      Creates a PropertyInfo object from a PropertyDescriptor.
      Parameters:
      pd - the property descriptor.
      Returns:
      the property info (null possible).
    • isAttributeProperty

      private boolean isAttributeProperty(Class c)
      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

      private String getHandlerClass(Class c)
      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

      private boolean contains(Class[] cAll, Class c)
      Checks, whether the class c is contained in the given class array.
      Parameters:
      cAll - the list of all classes
      c - the class to be searched
      Returns:
      true, if the class is contained in the array, false otherwise.