Class DataDescriptor
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
CompositeDataDescriptor
Only Serializable reference types may be described.
The data being described by this class and its subclasses is considered to be open data if it is one of the types defined by the OpenData interface.
Note: the aggregate open data types
must be described with the corresponding subclasses
of this class in order to be treated as open.
CompositeData should be described with CompositeDataDescriptor
and TabularData should be described with TabularDataDescriptor
Using DataDescriptor to describe these types is legal. However, it
will result in the isOpenData() method returning false.
The attributes accessed by the methods getDefault(), getLegalValueChoices(),
and getValueChoices() may be of a type whose class it not guaranteed to be
available on all virtual machines. To insure they can
be safely transmitted between virtual machines, they are internally stored in serialized
form. As a result, several of the methods of this class throw serialization related
exceptions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns a default value for this parameter.Returns a description of the parameter.Object[]Lists the legal values for the described parameter.getName()Returns the name of the described parameter.getType()Returns The fully-qualified class name of the described parameter.Object[]Lists possible values for the described parameter.booleanReturns true if the data object being described is typed (seegetType()) to be one of the non-aggregate open data types defined in the OpenData interface.toString()Returns a string representation of this descriptor.
-
Constructor Details
-
DataDescriptor
Constructs a DataDescriptor with only the required fields.It may be constructed to describe any serializable reference data type.
- Parameters:
name- The name of the data parameter being described. It must be a non-null, non-empty alphanumeric string.c- A class object representing the class type of the parameter being described. It must represent a reference type that is Serializable.desc- A description of the parameter being described- Throws:
IllegalArgumentException- if the parameter conditions are violated
-
DataDescriptor
public DataDescriptor(String name, Class c, String desc, Object def, Object[] leg, Object[] val) throws IOException Constructs a DataDescriptor.It may be constructed to describe any serializable reference data type.
- Parameters:
name- The name of the data parameter being described. It must be a non-null, non-empty alphanumeric string.c- A class object representing the class type of the parameter being described. It must represent a reference type that is Serializable.desc- A description of the parameter being describeddef- A default value that may be used for the parameter. Null indicates that a default is not specified. If non-null,defmust be of a type assignable to that represented by thetypeargument.leg- An array of legal values for this parameter. It indicates the only values this parameter may have. Null or empty array indicates that the legal values are not specified. If non-null, the array elements must all be of a type assignable to that represented by thetypeargument.val- An array of possible values for this parameter. Null or empty array indicates that the possible values are not specified. If non-null, the array elements must all be of a type assignable to that represented by thetypeargument.- Throws:
IllegalArgumentException- if the parameter conditions are violatedIOException- If a problem occurs during serialization ofdef, leg, val.
-
-
Method Details
-
getName
Returns the name of the described parameter.- Returns:
- The name of the described parameter.
-
getType
Returns The fully-qualified class name of the described parameter.- Returns:
- The fully-qualified class name of the described parameter.
-
getDescription
Returns a description of the parameter.- Returns:
- A description of the parameter.
-
getDefault
Returns a default value for this parameter.When this class is used to describe a method argument parameter, this value represents a valid default value.
This value has not been assigned any semantics when this class is used to describe a method return parameter.
A return of null indicates that no default has been specified.
The exceptions thrown by this method relate to the fact that this value is internally stored in a serialized form. They normally should not occur when dealing with open-data types.
- Returns:
- A default value for this parameter.
- Throws:
ClassNotFoundException- If the class represented by getType() can not be found. This will occur when attempting to access this field for a non-open data type without access to the corresponding classIOException- if problem is encountered while deserializing.
-
getLegalValueChoices
Lists the legal values for the described parameter.When this class is used to describe a method argument parameter, this value represents the list of legal values.
This value has not been assigned any semantics when this class is used to describe a method return parameter.
A return of null indicates that the legal values have not been specified.
The exceptions thrown by this method relate to the fact that this value is internally stored in a serialized form. They normally should not occur when dealing with open-data types.
- Returns:
- Legal values for this parameter
- Throws:
ClassNotFoundException- If the class represented by getType() can not be found. This will occur when attempting to access this field for a non-open data type without access to the corresponding classIOException- If problem is encountered while deserializing
-
getValueChoices
Lists possible values for the described parameter. Note, this does not imply that these are the only values this parameter may take on.When this class is used to describe a method argument parameter, this value represents a list of possible values.
This value has not been assigned any semantics when this class is used to describe a method return parameter.
A return of null indicates that the possible values have not been specified.
The exceptions thrown by this method relate to the fact that this value is internally stored in a serialized form. They normally should not occur when dealing with open-data types.
- Returns:
- Possible values for this parameter.
- Throws:
ClassNotFoundException- If the class represented by getType() can not be found. This will occur when attempting to access this field for a non-open data type without access to the corresponding classIOException- If problem is encountered while deserializing
-
isOpenData
public boolean isOpenData()Returns true if the data object being described is typed (seegetType()) to be one of the non-aggregate open data types defined in the OpenData interface.In order for the aggregate open data types CompositeData and TabularData to be treated as open data, they must be described by their corresponding descriptor classes CompositeDataDescriptor and TabularDataDescriptor
-
toString
Returns a string representation of this descriptor. -
equals
-