|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.threerings.antidote.property.BaseProperty<T>
public abstract class BaseProperty<T>
A base implementation for Property
objects to extend from. Generic type indicates the
type of object being held by the property after validation.
Constructor Summary | |
---|---|
BaseProperty(String name,
Field field)
Construct a new BaseProperty. |
|
BaseProperty(String name,
Field field,
T defaultValue)
Construct a new BaseProperty with a default value. |
Method Summary | |
---|---|
protected void |
appendViolation(Violation violation)
Add a violation to the list of violations returned when this Property is validated. |
Field |
getField()
Returns the Field this Property is attached to. |
String |
getPropertyName()
Returns the unique name of this field property. |
protected String |
getRawValue()
Provides concrete classes access to the raw user value. |
T |
getValue()
Returns the value assigned to this property, after it has been validated from the raw value. |
boolean |
isNotSet()
Returns true if the Mutable data contained in this object is not set, e.g. |
boolean |
isSet()
Returns true if the Mutable data contained in this object is set, e.g. |
void |
setValue(String value)
Sets the raw String value of the property. |
List<Violation> |
validate()
Implement validate() in the base abstract class ensuring correct behavior. |
protected abstract T |
validateProperty()
Give each Property a chance to do property specific validation and return the
validated value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BaseProperty(String name, Field field)
name
- The name of this property.field
- The Field
holding this property.public BaseProperty(String name, Field field, T defaultValue)
name
- The name of this property.field
- The Field
holding this property.defaultValue
- The default value for the field.Method Detail |
---|
public final String getPropertyName()
Property
getPropertyName
in interface Property<T>
public final Field getField()
Property
Field
this Property
is attached to.
getField
in interface Property<T>
public final T getValue()
Property
getValue
in interface Property<T>
public boolean isSet()
Mutable
Mutable
data contained in this object is set, e.g. not null.
False otherwise.
isSet
in interface Mutable
public boolean isNotSet()
Mutable
Mutable
data contained in this object is not set, e.g. null.
False otherwise.
isNotSet
in interface Mutable
public final List<Violation> validate()
validate
in interface RequiresValidation
appendViolation(Violation)
public final void setValue(String value)
protected abstract T validateProperty()
Property
a chance to do property specific validation and return the
validated value. If the raw value could not turned into a valid value, this will return null.
protected void appendViolation(Violation violation)
Property
is validated.
protected final String getRawValue()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |