|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dasein.attributes.DataType<V>
V - the Java data type that this data type operates onpublic abstract class DataType<V>
Represents a data type for the Dasein attributes system. A data type governs what
kind of values are valid for any attribute having this data type. To create custom
data types, you must extend this class as well as the DataTypeFactory class.
Last modified: $Date: 2009/02/02 19:27:05 $
| Nested Class Summary | |
|---|---|
static class |
DataType.InputType
Represents a type of input field associated with inputting values associated with this attributes system. |
| Constructor Summary | |
|---|---|
DataType(String nom,
String grp,
Number idx,
boolean ml,
boolean mv,
boolean req,
String... params)
Constructs a new data type instance. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object ob)
Two data type instances are considered identical if everything about them is the same. |
abstract Collection<V> |
getChoices()
Provides a list of values considered valid for this data type. |
abstract DataTypeFactory<V> |
getFactory()
|
String |
getGroup()
|
int |
getIndex()
|
abstract DataType.InputType |
getInputType()
|
String |
getName()
|
Collection<String> |
getParameters()
Type parameters tell a data type how to constrain values. |
int |
getSize()
|
Translator<V> |
getTranslatedValue(Object src,
Locale loc,
Translator<?> curr)
Provides a Translator instance for the requested value. |
abstract V |
getValue(Object src)
Implementors will implement this method to convert a raw value into a valid value of this data type. |
Collection<V> |
getValues(Object src)
When a data type is multi-valued, this method is called to convert raw data into a collection of values matching this data type. |
int |
hashCode()
|
boolean |
isMultiLingual()
|
boolean |
isMultiValued()
|
boolean |
isRequired()
|
abstract boolean |
isValidChoice(V arg)
Checks the specified value to see if it is valid for this data type. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DataType(String nom,
String grp,
Number idx,
boolean ml,
boolean mv,
boolean req,
String... params)
nom - the name of the data typegrp - the group of the data typeidx - the index of the data typeml - true if the type is multi-lingualmv - true if the type allows more than one valuereq - true if the type requires a value (cannot be null)params - a list of parameters constraining this type| Method Detail |
|---|
public boolean equals(Object ob)
equals in class Objectpublic abstract Collection<V> getChoices()
null.
null to allow any valuepublic abstract DataTypeFactory<V> getFactory()
public abstract DataType.InputType getInputType()
public final String getName()
public final String getGroup()
public final int getIndex()
public final Collection<String> getParameters()
public int getSize()
public Translator<V> getTranslatedValue(Object src,
Locale loc,
Translator<?> curr)
Translator instance for the requested value. This method is
generally called to turn an arbitrary object into a multi-lingual instance of
of the variable. Basically, when the system is trying to convert arbitrary
data—such as user input or values from a persistence engine—into
proper values for this type, it will call either this method or getValue(Object).
Which method is called is dependent on whether this data type is multi-lingual.
If the data type is multi-lingual, this method is called. This method will, in turn,
call getValue(Object) and wrap it in a Translator.
src - the raw data to be convertedloc - the locale associated with this valuecurr - any current values for other languages
public abstract V getValue(Object src)
InvalidAttributeException if
they are unable to interpret the raw value.
src - the raw value, such as user input or a string from a persistent store
public Collection<V> getValues(Object src)
src - the raw source value
public int hashCode()
hashCode in class Objectpublic final boolean isMultiLingual()
public final boolean isMultiValued()
public final boolean isRequired()
public abstract boolean isValidChoice(V arg)
Checks the specified value to see if it is valid for this data type. In general, implementing classes will check the following:
null valuegetChoices()
arg - the value being validated
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||