biz.c24.io.api.data
Class Attribute

java.lang.Object
  extended by biz.c24.io.api.data.DataComponent
      extended by biz.c24.io.api.data.Attribute
All Implemented Interfaces:
ModelComponent, Serializable
Direct Known Subclasses:
AnyAttribute, BuiltInAttribute

public class Attribute
extends DataComponent

A declaration of an attribute. Instances of this class are used to build up the structure of a ComplexDataType. This class encapsulates a type and the minimum and maximum cardinality of objects of that type WITHIN a particular scope. This class is responsible for the validation of cardinalities.

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
 
Fields inherited from class biz.c24.io.api.data.DataComponent
CARDINALITY_UNBOUNDED, IO_VALIDATE_DATABASE_KEY_PRESENCE
 
Constructor Summary
Attribute()
          Constructs a new instance which will require subsequent initialisation.
Attribute(String name, int minCardinality, int maxCardinality, Attribute ref, DataModel model)
          Constructs a new instance with the specified reference and other values.
Attribute(String name, int minCardinality, int maxCardinality, Class typeClass, DataModel model)
          Constructs a new lazily initialised instance with the specified type class and other values.
Attribute(String name, int minCardinality, int maxCardinality, SimpleDataType type, DataModel model)
          Constructs a new instance with the specified type and other values.
 
Method Summary
 boolean equals(Object o)
           
 String formatObject(Object obj)
          Returns a String representation of the supplied Object.
 Attribute getAttributeRef()
          Retuns the attribute ref.
 FormEnum getForm(boolean deep)
          Returns the form of this component or optionally the model's default.
 SimpleDataType getSimpleType()
          Returns the type of this attribute as a simple type.
 int hashCode()
           
 Object parseObject(String str)
          Returns an Object representation of the supplied String data.
 void setMaxCardinality(int maxCardinality)
          Sets the maximum cardinality of this attribute.
 void setMinCardinality(int minCardinality)
          Sets the minimum cardinality of this attribute.
 void setRef(DataComponent ref)
          Sets the ref of this attribute.
 void setType(DataType type)
          Sets the type of this attribute.
 
Methods inherited from class biz.c24.io.api.data.DataComponent
createObject, createObject, getAnnotation, getCardinalityConstraint, getCardinalityString, getDatabaseColumnName, getDefaultValue, getDescription, getFixedValue, getForm, getLengthConstraint, getLog, getMaxCardinality, getMinCardinality, getModel, getName, getOriginalName, getRef, getSSOffset, getType, isFixedCardinality, isGroup, isOptional, isPrimaryKey, isRepeating, setAnnotation, setCardinalityConstraint, setDatabaseColumnName, setDefaultValue, setFixedValue, setForm, setGroup, setLengthConstraint, setModel, setName, setOriginalName, setPrimaryKey, setSSOffset, toString, validate, validate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Attribute

public Attribute()
Constructs a new instance which will require subsequent initialisation.


Attribute

public Attribute(String name,
                 int minCardinality,
                 int maxCardinality,
                 Class typeClass,
                 DataModel model)
Constructs a new lazily initialised instance with the specified type class and other values.

Parameters:
name - The name of the attribute.
minCardinality - The minimum cardinality.
maxCardinality - The maximum cardinality or DataComponent.CARDINALITY_UNBOUNDED.
typeClass - The class of the type of the attribute.
model - The model.
Throws:
NullPointerException - if name or model are null.
IllegalArgumentException - if minimum or maximum cardinality are less than zero or greater than one or if minimum cardinality is greater than maximum cardinality.

Attribute

public Attribute(String name,
                 int minCardinality,
                 int maxCardinality,
                 SimpleDataType type,
                 DataModel model)
Constructs a new instance with the specified type and other values.

Parameters:
name - The name of the attribute.
minCardinality - The minimum cardinality.
maxCardinality - The maximum cardinality or DataComponent.CARDINALITY_UNBOUNDED.
type - The type of the attribute.
model - The model.
Throws:
NullPointerException - if name or model are null.
IllegalArgumentException - if minimum or maximum cardinality are less than zero or greater than one or if minimum cardinality is greater than maximum cardinality.

Attribute

public Attribute(String name,
                 int minCardinality,
                 int maxCardinality,
                 Attribute ref,
                 DataModel model)
Constructs a new instance with the specified reference and other values.

Parameters:
name - The name of the attribute.
minCardinality - The minimum cardinality.
maxCardinality - The maximum cardinality or DataComponent.CARDINALITY_UNBOUNDED.
ref - The attribute to refer to.
model - The model.
Throws:
NullPointerException - if name or model are null.
IllegalArgumentException - if minimum or maximum cardinality are less than zero or greater than one or if minimum cardinality is greater than maximum cardinality.
IllegalArgumentException - if the type of ref is not a SimpleDataType.
Method Detail

getAttributeRef

public Attribute getAttributeRef()
Retuns the attribute ref.

Returns:
The atttribute ref.

getSimpleType

public SimpleDataType getSimpleType()
Returns the type of this attribute as a simple type.

Returns:
The simple type.

setType

public void setType(DataType type)
Sets the type of this attribute.

Overrides:
setType in class DataComponent
Parameters:
type - The new type.
Throws:
IllegalArgumentException - if type is not a SimpleDataType.

setRef

public void setRef(DataComponent ref)
Sets the ref of this attribute.

Overrides:
setRef in class DataComponent
Parameters:
ref - The new ref.
Throws:
IllegalArgumentException - if the type of ref is not a SimpleDataType.

getForm

public FormEnum getForm(boolean deep)
Description copied from class: DataComponent
Returns the form of this component or optionally the model's default.

Overrides:
getForm in class DataComponent
Parameters:
deep - Whether to return the model's default form if this component's form is FormEnum.UNSPECIFIED.
Returns:
The form of this component or the model's default.

setMinCardinality

public void setMinCardinality(int minCardinality)
Sets the minimum cardinality of this attribute.

Overrides:
setMinCardinality in class DataComponent
Parameters:
minCardinality - The new value.
Throws:
IllegalArgumentException - if minimum cardinality is less than zero or greater than one.

setMaxCardinality

public void setMaxCardinality(int maxCardinality)
Sets the maximum cardinality of this attribute.

Overrides:
setMaxCardinality in class DataComponent
Parameters:
maxCardinality - The new value.
Throws:
IllegalArgumentException - if maximum cardinality is less than zero or greater than one.

parseObject

public Object parseObject(String str)
                   throws ParserException
Description copied from class: DataComponent
Returns an Object representation of the supplied String data.

Specified by:
parseObject in class DataComponent
Parameters:
str - The data to be parsed.
Returns:
The object.
Throws:
ParserException - If the data in the supplied String cannot be suitably rendered according to the type of this component.

formatObject

public String formatObject(Object obj)
Description copied from class: DataComponent
Returns a String representation of the supplied Object.

Specified by:
formatObject in class DataComponent
Parameters:
obj - The object representing the instance of this component.
Returns:
The String representation.

equals

public boolean equals(Object o)
Overrides:
equals in class DataComponent

hashCode

public int hashCode()
Overrides:
hashCode in class DataComponent


C24 Technologies © 2002-2012: All Rights Reserved.