Class DataDescriptorType

java.lang.Object
com.jbstrap.core.meta.DataDescriptorType

public final class DataDescriptorType extends Object
DataDescriptor class that defines types. This class defines types and their associated information for DataSources. These are the following:
  • DataDescriptor type name
  • Name of the class that implements the DataDescriptor
The framework uses these descriptions to instantiate DataDescriptor classes to be used the application.
Since:
4.0
Author:
JBStrap
  • Constructor Details

    • DataDescriptorType

      public DataDescriptorType(String name, Class<? extends DataDescriptor> dataDescriptorClass)
      Creates a new DataDescriptor type.
      Parameters:
      name - DataDescriptor name
      dataDescriptorClass - Class implementing the DataDescriptor
      Throws:
      NullPointerException - Thrown if the specified DataDescriptor name or class is null
      IllegalArgumentException - Thrown if the specified class does not contain a constructor that the framework uses to instantiate the DataDescriptor.
  • Method Details

    • getConstructor

      public Constructor<? extends DataDescriptor> getConstructor()
      Gets the constructor used to create the DataDescriptor.
      Returns:
      The constructor used to create the DataDescriptor
    • newInstance

      Creates a new DataDescriptor based on the type.
      Parameters:
      name - Unique DataDescriptor name
      domainClass - Domain class associated with the DataDescriptor
      Returns:
      DataDescriptor instance
      Throws:
      InstantiationException - Thrown if the DataDescriptor class is not loaded into the application
      IllegalAccessException - Thrown if the source code calling the method does not have access to the DataDescriptor
      InvocationTargetException - Thrown if the DataDescriptor’s constructor throws an exception
    • newInstance

      Creates a new DataDescriptor based on the type.
      Parameters:
      name - Unique DataDescriptor name
      Returns:
      DataDescriptor instance
      Throws:
      InstantiationException - Thrown if the DataDescriptor class is not loaded into the application
      IllegalAccessException - Thrown if the source code calling the method does not have access to the DataDescriptor
      InvocationTargetException - Thrown if the DataDescriptor’s constructor throws an exception
    • getName

      public String getName()
      Gets the DataDescriptor type name.
      Returns:
      DataDescriptor type name
    • getDataDescriptorClass

      public Class<? extends DataDescriptor> getDataDescriptorClass()
      Get the class that implements the DataDescriptor interface
      Returns:
      The class that implements the DataDescriptor interface
    • addDataDescriptionType

      public static void addDataDescriptionType(String name, Class<? extends DataDescriptor> dataDescriptorClass)
      Adds a new DataDescriptor type to the framework.
      Parameters:
      name - Unique DataDescriptor name You can specify any text name here that should be unique within the application. Use the specified name to reference the data descriptor type in the program logic or in the XML file’s connectorType attribute in the <datadescriptor> tag.
      dataDescriptorClass - Class implementing the DataDescriptor to be added
      Throws:
      NullPointerException - Thrown if the specified DataDescriptor name or class is null
      IllegalArgumentException - Thrown if the specified class does not contain a constructor that the framework uses to instantiate the DataDescriptor or if there already a DataDescriptor type with that name in the framework.
    • fromName

      public static DataDescriptorType fromName(String name)
      Gets the DataDescriptor type by its name.
      Parameters:
      name - DataDescriptor type name
      Returns:
      DataDescriptor type name or null if there is no DataDescriptor with the specified name in the framework
    • fromClass

      public static DataDescriptorType fromClass(Class<? extends DataDescriptor> dataDescriptorClass)
      Gets the DataDescriptor type by the implementing class.
      Parameters:
      dataDescriptorClass - The DataDescriptor’s implementing class that also contains the DataDescriptor type
      Returns:
      DataDescriptor type for the specified class, or null, if there is no corresponding DataDescriptor type for the specified class