|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectPropertyImpl
LenientAttribute
public class LenientAttribute
Simple, mutable class to store attributes - that does not validate!
Field Summary | |
---|---|
protected Identifier |
id
id of the attribute. |
Fields inherited from class PropertyImpl |
---|
descriptor, userData, value |
Constructor Summary | |
---|---|
LenientAttribute(Object content,
AttributeDescriptor descriptor,
String id)
|
|
LenientAttribute(Object content,
AttributeType type,
String id)
|
Method Summary | |
---|---|
boolean |
equals(Object obj)
Override of equals. |
AttributeDescriptor |
getDescriptor()
The PropertyDscriptor of the property, null if this is a top-level value. |
Identifier |
getIdentifier()
Unique Identifier for the attribute. |
AttributeType |
getType()
The type of the property. |
int |
hashCode()
Override of hashCode. |
boolean |
isValid()
|
protected Object |
parse(Object value)
Allows this Attribute to convert an argument to its prefered storage type. |
void |
setValue(Object newValue)
Override of setValue to convert the newValue to specified type if need be. |
String |
toString()
|
void |
validate()
Check the attribute value against the constraints provided by the AttributeDescriptor. |
Methods inherited from class PropertyImpl |
---|
getName, getUserData, getValue, isNillable |
Methods inherited from class Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface Property |
---|
getName, getUserData, getValue, isNillable |
Field Detail |
---|
protected final Identifier id
Constructor Detail |
---|
public LenientAttribute(Object content, AttributeDescriptor descriptor, String id)
public LenientAttribute(Object content, AttributeType type, String id)
Method Detail |
---|
public Identifier getIdentifier()
Attribute
This value is non-null in the case that
getType().isIdentifiable()
is true
.
getIdentifier
in interface Attribute
null
if
the attribute is non-identifiable.public AttributeDescriptor getDescriptor()
Property
PropertyDscriptor
of the property, null if this is a top-level value.
The descriptor provides information about the property with respect to
its containing entity (more often then not a Feature
or ComplexAttribute
.
getDescriptor
in interface Attribute
getDescriptor
in interface Property
getDescriptor
in class PropertyImpl
ComplexAttribute
public AttributeType getType()
Property
The type contains information about the value or content of the property such as its java class.
This value is also available via getDescriptor().getType()
.
getType
in interface Attribute
getType
in interface Property
getType
in class PropertyImpl
Property.getType()
public void setValue(Object newValue) throws IllegalArgumentException, IllegalStateException
setValue
in interface Property
setValue
in class PropertyImpl
newValue
- The new value of the property.
IllegalArgumentException
IllegalStateException
public int hashCode()
hashCode
in class PropertyImpl
public boolean equals(Object obj)
equals
in class PropertyImpl
other
- the object to be tested for equality.
public boolean isValid()
public String toString()
toString
in class PropertyImpl
protected Object parse(Object value) throws IllegalArgumentException
value
- the object to attempt parsing of.
value
converted to the preferred storage of this
AttributeType
. If no parsing was possible then
the same object is returned.
IllegalArgumentException
- if parsing is attempted and is unsuccessful.public void validate() throws IllegalAttributeException
Attribute
Please note this method checks the value only - it should have the correct java binding, it should only be null if isNillable is true; and if a value is provided it should satisfy all of the restrictions provided.
To check the the number of times an attribute is used (minOccurs and maxOccurs) please use ComplexAttribute.validate().
validate
in interface Attribute
IllegalAttributeException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |