AbstractPropertyDefinition Class
- public abstract class AbstractPropertyDefinition
extends Object
implements PropertyDefinition
, Serializable
Default implementation of a PropertyDefinition.
-
Hierarchy
-
Object
AbstractPropertyDefinition
-
All Implemented Interfaces
-
PropertyDefinition
, Serializable
-
Direct Known Subclasses
-
PropertyDefinitionImpl
public int |
-
compareTo (Object o)
- Implementation of Object.compareTo(); returns 0 if the two objects
are equal; attempts to determine an ordering otherwise and returns
-1 if this object is less than the comparison object, and 1 if this
object is greater than the comparison object.
|
protected int |
-
determinePropertyType (Object value)
- Determines if the data type of the property value
is a known property type.
|
public boolean |
-
equals (Object o)
- Equality operator.
|
public Object |
-
getDefaultValue ()
- Get the default value for this property.
|
public String |
-
getDescription ()
- Get the description of this property
|
public Collection |
-
getRestrictedValues ()
- Get the allowable values, if this property is restricted.
|
public int |
-
getType ()
- Get the datatype of the property
|
public int |
-
hashCode ()
- Computes a hashcode for this object based on its attributes
|
public boolean |
-
isMultiValued ()
- Can this property support multiple values?
|
public boolean |
-
isRestricted ()
- Is this property restricted to a certain list of values?
|
public void |
-
setDefaultValue (Object o)
- Set the default value for this property.
|
public void |
-
setDescription (String s)
- Set the description of this property
|
public void |
-
setMultiValued (boolean b)
- Set if this property support multiple values?
|
public void |
-
setRestricted (boolean b)
- Set if this property restricted to a certain list of values?
|
public void |
-
setRestrictedValues (Collection c)
- Set the allowable values, if this property is restricted
|
public void |
-
setType (int i)
- Set the datatype of the property
|
public String |
-
toString ()
- Basic toString method
|
public void |
-
validate (Object value)
- Validates the given value against the property definition.
|
AbstractPropertyDefinition
public AbstractPropertyDefinition()
- Default constructor
AbstractPropertyDefinition
public AbstractPropertyDefinition(String
descriptionArg,
int typeArg,
boolean multiValuedArg,
boolean restrictedArg,
Collection
restrictedValuesArg,
Object
defaultValueArg)
- Constructor to initialize attributes
compareTo(Object) Method
public int compareTo(Object
o)
Implementation of Object.compareTo(); returns 0 if the two objects
are equal; attempts to determine an ordering otherwise and returns
-1 if this object is less than the comparison object, and 1 if this
object is greater than the comparison object. Because Property
Definitions do not have an inherent order, any non-zero value
is somewhat arbitrary.
determinePropertyType(Object) Method
protected int determinePropertyType(Object
value)
Determines if the data type of the property value
is a known property type. Defaults to USER_DEFINED if the type
of the value cannot be determined.
Returns
int
which is one of the datatype constants defined in the PropertyDefinition interface
equals(Object) Method
public boolean equals(Object
o)
Equality operator.
-
Overrides
-
Object.equals(Object)
Returns
- true if the compareTomethod would return 0 for this target
getDefaultValue() Method
public Object
getDefaultValue()
Get the default value for this property. If it is multivalued,
this might be a collection of values. Note: this returns a clone
of the default value; if it is a collection, and the property
values are mutable objects, care must be taken not to modify them.
Returns
- the default value, or null if there is none
getDescription() Method
public String
getDescription()
Get the description of this property
getRestrictedValues() Method
public Collection
getRestrictedValues()
Get the allowable values, if this property is restricted. Note: this
does a shallow clone to prevent the collection from being modified,
but if any property values are mutable, care must be taken not to
modify them.
Returns
- a Collection of allowable values, or null if there are none
getType() Method
public int getType()
Get the datatype of the property
hashCode() Method
public int hashCode()
Computes a hashcode for this object based on its attributes
-
Overrides
-
Object.hashCode()
Returns
- the calculated hashcode
isMultiValued() Method
public boolean isMultiValued()
Can this property support multiple values?
isRestricted() Method
public boolean isRestricted()
Is this property restricted to a certain list of values?
setDefaultValue(Object) Method
public void setDefaultValue(Object
o)
Set the default value for this property.
setDescription(String) Method
public void setDescription(String
s)
Set the description of this property
setMultiValued(boolean) Method
public void setMultiValued(boolean b)
Set if this property support multiple values?
setRestricted(boolean) Method
public void setRestricted(boolean b)
Set if this property restricted to a certain list of values?
setRestrictedValues(Collection) Method
public void setRestrictedValues(Collection
c)
Set the allowable values, if this property is restricted
setType(int) Method
public void setType(int i)
Set the datatype of the property
toString() Method
public String
toString()
Basic toString method
-
Overrides
-
Object.toString()
Returns
- a displayable String representing this property definition
validate(Object) Method
public void validate(Object
value)
throws PropertyValidationException
Validates the given value against the property definition. Compares
datatypes, and checks against allowable values.
Exceptions
-
PropertyValidationException
- if the value is not valid