|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mmbase.core.AbstractDescriptor
org.mmbase.datatypes.BasicDataType<E>
org.mmbase.datatypes.ComparableDataType<E>
public abstract class ComparableDataType<E extends Serializable & Comparable<E>>
Comparable datatypes have values which are Comparable, so can be ordered, and
therefore can have a minimum and a maximum value.
| Nested Class Summary | |
|---|---|
protected class |
ComparableDataType.MaxRestriction
|
protected class |
ComparableDataType.MinRestriction
|
| Nested classes/interfaces inherited from class org.mmbase.datatypes.BasicDataType |
|---|
BasicDataType.AbstractRestriction<D extends Serializable>, BasicDataType.DataTypeComparator<D>, BasicDataType.EnumerationRestriction, BasicDataType.RequiredRestriction, BasicDataType.RestrictedEnumerationIterator, BasicDataType.StaticAbstractRestriction<D extends Serializable>, BasicDataType.TypeRestriction, BasicDataType.UniqueRestriction |
| Nested classes/interfaces inherited from interface org.mmbase.datatypes.DataType |
|---|
DataType.Restriction<D extends Serializable> |
| Field Summary | |
|---|---|
protected ComparableDataType.MaxRestriction |
maxRestriction
|
protected ComparableDataType.MinRestriction |
minRestriction
|
| Fields inherited from class org.mmbase.datatypes.BasicDataType |
|---|
DATATYPE_BUNDLE, defaultValue, enumerationRestriction, origin, requiredRestriction, typeRestriction, uniqueRestriction |
| Fields inherited from class org.mmbase.core.AbstractDescriptor |
|---|
description, guiName, key |
| Fields inherited from interface org.mmbase.datatypes.DataType |
|---|
ENFORCE_ABSOLUTE, ENFORCE_ALWAYS, ENFORCE_NEVER, ENFORCE_ONCHANGE, ENFORCE_ONCREATE, ENFORCE_ONVALIDATE, PROCESS_GET, PROCESS_SET, VALID, XMLNS |
| Constructor Summary | |
|---|---|
protected |
ComparableDataType(String name,
Class<E> classType)
|
| Method Summary | |
|---|---|
ComparableDataType<E> |
clone(String name)
Returns a cloned instance of this datatype, inheriting all validation rules. |
protected void |
cloneRestrictions(BasicDataType<E> origin)
If a datatype is cloned, the restrictions of it (normally implemented as inner classes), must be reinstantiated. |
protected int |
compare(E comp1,
E comp2)
|
abstract E |
first()
Returns a natural 'first' value. |
Comparator<E> |
getComparator()
|
E |
getDefaultValue(Locale locale,
Cloud cloud,
Field field)
Returns the (locale dependent) default value of this data type, |
int |
getEnforceStrength()
The maximum enforce strength of all restrictions on this datatype. |
DataType.Restriction<E> |
getMaxRestriction()
|
DataType.Restriction<E> |
getMinRestriction()
|
protected void |
inheritRestrictions(BasicDataType<E> origin)
If a datatype inherits from another datatype all its restrictions inherit too. |
boolean |
isMaxInclusive()
Returns whether the maximum value for this data type is inclusive or not. |
boolean |
isMinInclusive()
Returns whether the minimum value for this data type is inclusive or not. |
void |
setMax(E value,
boolean inclusive)
Sets the maximum Date value for this data type. |
void |
setMin(E value,
boolean inclusive)
Sets the minimum Date value for this data type. |
protected StringBuilder |
toStringBuilder()
|
void |
toXml(Element parent)
Fills this datatype in another XML (for example in the xml of DataType.getOrigin(), to make one
XML, fully describing the DataType). |
protected Collection<LocalizedString> |
validateCastValue(Collection<LocalizedString> errors,
Object castValue,
Object value,
Node node,
Field field)
|
| Methods inherited from class org.mmbase.core.AbstractDescriptor |
|---|
getDefaultLocale, getDescription, getDescription, getGUIName, getGUIName, getLocalizedDescription, getLocalizedGUIName, getName, setDescription, setDescription, setGUIName, setGUIName, setLocalizedDescription, setLocalizedGUIName |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.mmbase.bridge.Descriptor |
|---|
getDescription, getDescription, getGUIName, getGUIName, getLocalizedDescription, getLocalizedGUIName, getName, setDescription, setDescription, setGUIName, setGUIName |
| Field Detail |
|---|
protected ComparableDataType.MinRestriction minRestriction
protected ComparableDataType.MaxRestriction maxRestriction
| Constructor Detail |
|---|
protected ComparableDataType(String name,
Class<E> classType)
| Method Detail |
|---|
protected void inheritRestrictions(BasicDataType<E> origin)
BasicDataType
inheritRestrictions in class BasicDataType<E extends Serializable & Comparable<E>>protected void cloneRestrictions(BasicDataType<E> origin)
BasicDataType
cloneRestrictions in class BasicDataType<E extends Serializable & Comparable<E>>public DataType.Restriction<E> getMinRestriction()
public boolean isMinInclusive()
true if the minimum value if inclusive, false if it is not, or if there is no minimum.public DataType.Restriction<E> getMaxRestriction()
public boolean isMaxInclusive()
true if the maximum value if inclusive, false if it is not, or if there is no minimum.
public E getDefaultValue(Locale locale,
Cloud cloud,
Field field)
BasicDataType
getDefaultValue in interface DataType<E extends Serializable & Comparable<E>>getDefaultValue in class BasicDataType<E extends Serializable & Comparable<E>>public void toXml(Element parent)
DataTypeDataType.getOrigin(), to make one
XML, fully describing the DataType). The implementation of this method is
unfinished!
toXml in interface DataType<E extends Serializable & Comparable<E>>toXml in class BasicDataType<E extends Serializable & Comparable<E>>parent - a 'datatype' element.
public void setMin(E value,
boolean inclusive)
value - the minimum as an Comparable (and Serializable), or null if there is no minimum.inclusive - whether the minimum value is inclusive or not
Class<T> - Identifier: java.lang.UnsupportedOperationException if this data type is read-only (i.e. defined by MMBase)
public void setMax(E value,
boolean inclusive)
value - the maximum as an Comparable (and Serializable), or null if there is no maximum.inclusive - whether the maximum value is inclusive or not
Class<T> - Identifier: java.lang.UnsupportedOperationException if this data type is read-only (i.e. defined by MMBase)public int getEnforceStrength()
DataTypeDataType.ENFORCE_ALWAYS, DataType.ENFORCE_ONCHANGE, DataType.ENFORCE_NEVER.
getEnforceStrength in interface DataType<E extends Serializable & Comparable<E>>getEnforceStrength in class BasicDataType<E extends Serializable & Comparable<E>>
protected Collection<LocalizedString> validateCastValue(Collection<LocalizedString> errors,
Object castValue,
Object value,
Node node,
Field field)
validateCastValue in class BasicDataType<E extends Serializable & Comparable<E>>public ComparableDataType<E> clone(String name)
BasicDataTypeBasicDataType.inheritProperties(BasicDataType) and BasicDataType.cloneRestrictions(BasicDataType). A clone is not finished. See BasicDataType.isFinished().
clone in interface DataType<E extends Serializable & Comparable<E>>clone in class BasicDataType<E extends Serializable & Comparable<E>>name - the new name of the copied datatype (can be null, in which case the name is not changed).
protected StringBuilder toStringBuilder()
toStringBuilder in class BasicDataType<E extends Serializable & Comparable<E>>
protected int compare(E comp1,
E comp2)
public Comparator<E> getComparator()
getComparator in class BasicDataType<E extends Serializable & Comparable<E>>public abstract E first()
0
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||