Package com.jbstrap.core.meta
Class DataDescriptorType
java.lang.Object
com.jbstrap.core.meta.DataDescriptorType
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
- Since:
- 4.0
- Author:
- JBStrap
-
Constructor Summary
ConstructorDescriptionDataDescriptorType
(String name, Class<? extends DataDescriptor> dataDescriptorClass) Creates a new DataDescriptor type. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addDataDescriptionType
(String name, Class<? extends DataDescriptor> dataDescriptorClass) Adds a new DataDescriptor type to the framework.static DataDescriptorType
fromClass
(Class<? extends DataDescriptor> dataDescriptorClass) Gets the DataDescriptor type by the implementing class.static DataDescriptorType
Gets the DataDescriptor type by its name.Constructor<? extends DataDescriptor>
Gets the constructor used to create the DataDescriptor.Class<? extends DataDescriptor>
Get the class that implements the DataDescriptor interfacegetName()
Gets the DataDescriptor type name.newInstance
(String name) Creates a new DataDescriptor based on the type.newInstance
(String name, String domainClass) Creates a new DataDescriptor based on the type.
-
Constructor Details
-
DataDescriptorType
Creates a new DataDescriptor type.- Parameters:
name
- DataDescriptor namedataDescriptorClass
- Class implementing the DataDescriptor- Throws:
NullPointerException
- Thrown if the specified DataDescriptor name or class isnull
IllegalArgumentException
- Thrown if the specified class does not contain a constructor that the framework uses to instantiate the DataDescriptor.
-
-
Method Details
-
getConstructor
Gets the constructor used to create the DataDescriptor.- Returns:
- The constructor used to create the DataDescriptor
-
newInstance
public DataDescriptor newInstance(String name, String domainClass) throws InstantiationException, IllegalAccessException, InvocationTargetException Creates a new DataDescriptor based on the type.- Parameters:
name
- Unique DataDescriptor namedomainClass
- Domain class associated with the DataDescriptor- Returns:
- DataDescriptor instance
- Throws:
InstantiationException
- Thrown if the DataDescriptor class is not loaded into the applicationIllegalAccessException
- Thrown if the source code calling the method does not have access to the DataDescriptorInvocationTargetException
- Thrown if the DataDescriptor’s constructor throws an exception
-
newInstance
public DataDescriptor newInstance(String name) throws InstantiationException, IllegalAccessException, InvocationTargetException 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 applicationIllegalAccessException
- Thrown if the source code calling the method does not have access to the DataDescriptorInvocationTargetException
- Thrown if the DataDescriptor’s constructor throws an exception
-
getName
Gets the DataDescriptor type name.- Returns:
- DataDescriptor type name
-
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’sconnectorType
attribute in the <datadescriptor> tag.dataDescriptorClass
- Class implementing the DataDescriptor to be added- Throws:
NullPointerException
- Thrown if the specified DataDescriptor name or class isnull
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
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
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
-