biz.c24.io.api.data
Class DataType

java.lang.Object
  extended by biz.c24.io.api.data.DataType
All Implemented Interfaces:
ModelComponent, Serializable
Direct Known Subclasses:
ComplexDataType, SimpleDataType

public class DataType
extends Object
implements ModelComponent

A data type, analagous to a java.lang.Class.
Data types store the definition of the data, i.e. their structure, presentation & validation properties. Each data object is releated to a data type, in the same way that each java.lang.Object instance has a Class. Subclasses of this class are deployed as singletons by the Designer.

Warning: Serialized objects of this class or of a deployed class which is derived from it may not be compatible with future releases of C24 Integreation Objects. The current serialization support is appropriate for short term storage or RMI between applications running the same version of C24 Integreation Objects.

See Also:
Serialized Form

Field Summary
protected  boolean duringParsing
           
protected  boolean hasEnumerations
          Validates an object against its data type properties.
protected  boolean hasPatternMatching
           
protected  boolean qualifierValidation
           
 
Method Summary
 void addDerivedType(String typeName, DataType derivedType)
          s Adds a derived type.
 void addValidator(int index, Validator validator)
          Adds a validator at index.
 void addValidator(Validator validator)
          Adds a validator.
 Set derivedTypeKeySet()
          Returns a Set containing the names of all types derived from this type.
 Annotation getAnnotation()
          Returns the annotation associated with this type.
 String getDatabaseColumnName()
          Returns the name of the database column that this component represents.
 DataType getDerivedType(String typeName)
          Returns a type derived from this type called typeName.
 DataType getDerivedType(String typeName, String uri)
          Returns a type derived from this type called typeName in namespace uri.
 DataType[] getDerivedTypes(String typeName)
          Returns all types derived from this type called typeName in any namespace.
 String getDescription()
          Returns a description of this type.
 Enumeration getEnumeration()
          Returns the enumeration applied to this type.
 String[] getInitiator()
          Returns the initiator(s).
 DataModel getModel()
          Returns the model.
 String getName()
          Returns the name of this component.
 Element getNullDefiningElementDecl()
          Returns the element that will be used to define objects created in the absence of any other defining element declaration.
 String getOriginalName()
          Returns the original name if it is different to the name property, otherwise the name is returned.
 String getOriginalPatternMatch()
          Gets the original pattern match.
 String getPatternMatch()
          Returns the pattern match.
 PatternTypeEnum getPatternType()
          Returns the syntax of the pattern.
 String[] getTerminator()
          Returns the terminator(s).
 Validator getValidator(int index)
          Returns the validator at index.
 int getValidatorCount()
          Returns the number of validators defined for this type.
 int getValidatorIndex(Validator v)
          Returns the index of v.
 Class getValidObjectClass()
          Returns the class of valid objects of this type.
 boolean hasDerivedTypes()
          Return whether this type has derived types.
 boolean isComplex()
          Returns whether this type is complex.
 boolean isLocal()
          Returns whether this type is local, i.e. defined within another type.
 boolean isSimple()
          Returns whether this type is simple.
 boolean isValidObjectClass(Class c)
          Returns whether c is the class of a valid object of this type.
 void removeDerivedType(String typeName, String uri)
          Removes a derived type.
 void removeValidator(int index)
          Removed the validator at index.
 void setAnnotation(Annotation annotation)
          Sets the annotation.
 void setDatabaseColumnName(String databaseColumnName)
          Sets the database column name of the component
 void setInitiator(String[] initiator)
          Sets the initiator(s).
 void setLocal(boolean local)
          Sets whether this type is local.
 void setModel(DataModel model)
          Sets the model.
 void setName(String name)
          Sets the name.
 void setOriginalName(String originalName)
          Sets the original name of the component.
 void setOriginalPatternMatch(String originalPatternMatch)
          Sets the original pattern match.
 void setPatternMatch(String patternMatch)
          Sets the pattern match.
 void setPatternType(PatternTypeEnum patternType)
          Sets the type of pattern match.
 void setTerminator(String[] terminator)
          Sets the terminator(s).
 String toString()
           
 boolean validate(Object obj, DataComponent comp, ComplexDataObject context)
          Deprecated. Use ValidationManager instead - this method will be removed in the next major version release.
 boolean validateProperties(Object object, ComplexDataObject context, DataComponent comp, ValidationConstraints constraints)
          Deprecated. Use ValidationManager instead - this method will be removed in the next major version release.
 boolean validateProperties(Object object, DataComponent comp, ComplexDataObject context, ValidationManager manager)
           
 boolean validateProperties(Object object, DataComponent comp, ComplexDataObject context, ValidationManager manager, boolean duringParsing)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

hasEnumerations

protected boolean hasEnumerations
Validates an object against its data type properties.


hasPatternMatching

protected boolean hasPatternMatching

qualifierValidation

protected boolean qualifierValidation

duringParsing

protected boolean duringParsing
Method Detail

getNullDefiningElementDecl

public Element getNullDefiningElementDecl()
Returns the element that will be used to define objects created in the absence of any other defining element declaration.

Returns:
The element.

isSimple

public boolean isSimple()
Returns whether this type is simple. Note: a complex type can return true from this method if it is derived from a simple type.

Returns:
Whether this type is simple.

isComplex

public boolean isComplex()
Returns whether this type is complex.

Returns:
Whether this type is complex.

getName

public String getName()
Description copied from interface: ModelComponent
Returns the name of this component.

Specified by:
getName in interface ModelComponent
Returns:
The name.

setName

public void setName(String name)
Sets the name.

Parameters:
name - The name.

getModel

public DataModel getModel()
Returns the model.

Returns:
The model.

setModel

public void setModel(DataModel model)
Sets the model.

Parameters:
model - The model.

getOriginalName

public String getOriginalName()
Returns the original name if it is different to the name property, otherwise the name is returned.

Returns:
The original name.

setOriginalName

public void setOriginalName(String originalName)
Sets the original name of the component.

Parameters:
originalName - The new original name.

getDatabaseColumnName

public String getDatabaseColumnName()
Returns the name of the database column that this component represents.

Returns:
The column name.

setDatabaseColumnName

public void setDatabaseColumnName(String databaseColumnName)
Sets the database column name of the component

Parameters:
databaseColumnName - The actual database column name

isLocal

public boolean isLocal()
Returns whether this type is local, i.e. defined within another type.

Returns:
Whether this type is local.

setLocal

public void setLocal(boolean local)
Sets whether this type is local.

Parameters:
local - The new value.

getDerivedType

public DataType getDerivedType(String typeName)
Returns a type derived from this type called typeName.

The type is assumed to be in the same namespace as this type.

Parameters:
typeName - The name of the type to return.
Returns:
The derived type if present, or null otherwise.
See Also:
getDerivedType(String, String), getDerivedTypes(String), derivedTypeKeySet()

getDerivedType

public DataType getDerivedType(String typeName,
                               String uri)
Returns a type derived from this type called typeName in namespace uri.

Parameters:
typeName - The name of the type to return.
uri - The namespace uri, or null to return the first derived type found with the given name.
Returns:
The derived type if present, or null otherwise.
See Also:
derivedTypeKeySet()

getDerivedTypes

public DataType[] getDerivedTypes(String typeName)
Returns all types derived from this type called typeName in any namespace.

Parameters:
typeName - The name of the type to return.
Returns:
An non-null array of derived types.
See Also:
derivedTypeKeySet()

hasDerivedTypes

public boolean hasDerivedTypes()
Return whether this type has derived types.

Returns:
Whether this type has derived types.

derivedTypeKeySet

public Set derivedTypeKeySet()
Returns a Set containing the names of all types derived from this type.

Returns:
The set.

addDerivedType

public void addDerivedType(String typeName,
                           DataType derivedType)
s Adds a derived type.

Parameters:
typeName - The name of the type.
derivedType - The type.
Throws:
IllegalArgumentException - If derivedType does not have a model associated with it.

removeDerivedType

public void removeDerivedType(String typeName,
                              String uri)
Removes a derived type.

Parameters:
typeName - The name of the type.
uri - The namespace uri of the type.

getAnnotation

public Annotation getAnnotation()
Returns the annotation associated with this type.

Returns:
The annotation.

setAnnotation

public void setAnnotation(Annotation annotation)
Sets the annotation.

Parameters:
annotation - The annotation.

getDescription

public String getDescription()
Returns a description of this type.

The description is taken from the annotation if one is present, otherwise the empty string is returned.

Returns:
The description.

getInitiator

public String[] getInitiator()
Returns the initiator(s). Any item in the returned array is considered a valid initiator but the first item will always be used when formatting. The array returned by this method will never be of length 0, it will be null if no initiators have been specified.

Returns:
The initiator(s).

setInitiator

public void setInitiator(String[] initiator)
Sets the initiator(s).

Parameters:
initiator - The initiator(s).

getTerminator

public String[] getTerminator()
Returns the terminator(s). Any item in the returned array is considered a valid initiator but the first item will always be used when formatting. The array returned by this method will never be of length 0, it will be null if no terminators have been specified.

Returns:
The terminator(s).

setTerminator

public void setTerminator(String[] terminator)
Sets the terminator(s).

Parameters:
terminator - The terminator(s).

getPatternMatch

public String getPatternMatch()
Returns the pattern match. The pattern match is a regular expression which must be matched in order for objects of this type to be deemed valid. The syntax of the pattern match is given by getPatternType().

Returns:
The pattern match.

setPatternMatch

public void setPatternMatch(String patternMatch)
Sets the pattern match.

Parameters:
patternMatch - The pattern match.

getOriginalPatternMatch

public String getOriginalPatternMatch()
Gets the original pattern match. This will be different from getPatternMatch() if the pattern has been interpreted into a different syntax, e.g. for SWIFT.

Returns:
The uninterpretted pattern match.

setOriginalPatternMatch

public void setOriginalPatternMatch(String originalPatternMatch)
Sets the original pattern match.

Parameters:
originalPatternMatch - The original pattern match.

getPatternType

public PatternTypeEnum getPatternType()
Returns the syntax of the pattern.

Returns:
The patterns syntax.

setPatternType

public void setPatternType(PatternTypeEnum patternType)
Sets the type of pattern match.

Parameters:
patternType - The type of pattern match.

getValidatorCount

public int getValidatorCount()
Returns the number of validators defined for this type.

Returns:
The number of validators.

getValidator

public Validator getValidator(int index)
Returns the validator at index.

Parameters:
index - The index.
Returns:
The validator.

getValidatorIndex

public int getValidatorIndex(Validator v)
Returns the index of v.

Parameters:
v - The validator.
Returns:
The index.

getEnumeration

public Enumeration getEnumeration()
Returns the enumeration applied to this type. This method iterates through the validators and returns the first eunmeration it comes across.

Returns:
The enumeration.

addValidator

public void addValidator(Validator validator)
Adds a validator.

Parameters:
validator - The validator to add.

addValidator

public void addValidator(int index,
                         Validator validator)
Adds a validator at index.

Parameters:
validator - The validator to add.
index - The index to add it at.

removeValidator

public void removeValidator(int index)
Removed the validator at index.

Parameters:
index - The index.

validateProperties

public boolean validateProperties(Object object,
                                  ComplexDataObject context,
                                  DataComponent comp,
                                  ValidationConstraints constraints)
                           throws ValidationException
Deprecated. Use ValidationManager instead - this method will be removed in the next major version release.

Validates an object against its data type properties.

Parameters:
object - An object representing the value to be validated.
context - The context in which the object appears.
comp - The component representing the instance of this type being validated.
constraints - The validation constraints to be used in performing validation.
Returns:
true if the object is valid against its type.
Throws:
ValidationException - if the object is not valid against its type.
IllegalArgumentException - If object is not a valid object class.

validateProperties

public boolean validateProperties(Object object,
                                  DataComponent comp,
                                  ComplexDataObject context,
                                  ValidationManager manager)
                           throws ValidationException
Throws:
ValidationException

validateProperties

public boolean validateProperties(Object object,
                                  DataComponent comp,
                                  ComplexDataObject context,
                                  ValidationManager manager,
                                  boolean duringParsing)
                           throws ValidationException
Throws:
ValidationException

toString

public String toString()
Overrides:
toString in class Object

isValidObjectClass

public boolean isValidObjectClass(Class c)
Returns whether c is the class of a valid object of this type.

Parameters:
c - The class.
Returns:
Whether it is valid or not.

getValidObjectClass

public Class getValidObjectClass()
Returns the class of valid objects of this type.

Returns:
The class.

validate

public boolean validate(Object obj,
                        DataComponent comp,
                        ComplexDataObject context)
                 throws ValidationException
Deprecated. Use ValidationManager instead - this method will be removed in the next major version release.

Validate the given object.

Parameters:
obj - The object to be validated.
comp - The defining element or attribute of the object to be validated.
context - The context.
Returns:
Whether the object is valid.
Throws:
ValidationException - If the object is not valid AND the validation mechanism specified for obj is ValidationMechanismEnum.VALIDATION_MECHANISM_EXCEPTION.


C24 Technologies © 2002-2012: All Rights Reserved.