|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mmbase.datatypes.BasicDataType.StaticAbstractRestriction
A Restriction is represented by these kind of objects. When you override this class, take care of cloning of outer class! This class itself is not cloneable. Cloning is hard when you have inner classes. All restrictions extend from this. See article about inner classes, cloning in java
| Field Summary | |
protected BasicDataType.StaticAbstractRestriction |
absoluteParent
If a restriction has an 'absolute' parent restriction, then also that restriction must be valid (because it was 'absolute'). |
protected int |
enforceStrength
|
protected LocalizedString |
errorDescription
|
protected boolean |
fixed
|
protected String |
name
|
protected BasicDataType |
parent
|
protected Serializable |
value
|
| Constructor Summary | |
protected |
BasicDataType.StaticAbstractRestriction(BasicDataType parent,
BasicDataType.StaticAbstractRestriction source)
Instantaties new restriction for a clone of the parent DataType. |
protected |
BasicDataType.StaticAbstractRestriction(BasicDataType parent,
String name,
Serializable value)
|
| Method Summary | |
protected Collection |
addError(Collection errors,
Object v,
Node node,
Field field)
Utility method to add a new error message to the errors collection, based on this Restriction. |
protected boolean |
enforce(Node node,
Field field)
Whether validate(java.util.Collection, java.lang.Object, org.mmbase.bridge.Node, org.mmbase.bridge.Field) must enforce this condition |
int |
getEnforceStrength()
See DataType.ENFORCE_ALWAYS, DataType.ENFORCE_ONCHANGE, DataType.ENFORCE_NEVER. |
LocalizedString |
getErrorDescription()
If the restriction does not hold, the following error description can be used. |
String |
getName()
|
Serializable |
getValue()
A Value describing the restriction, so depending on the semantics of this restriction, it can have virtually every type (as long as it is Serializable) |
protected void |
inherit(BasicDataType.StaticAbstractRestriction source)
|
protected void |
inherit(BasicDataType.StaticAbstractRestriction source,
boolean cast)
|
boolean |
isFixed()
|
void |
setEnforceStrength(int e)
|
void |
setErrorDescription(LocalizedString errorDescription)
|
void |
setFixed(boolean fixed)
If a restriction is 'fixed', the value and error-description cannot be changed any more. |
void |
setValue(Serializable v)
|
protected abstract boolean |
simpleValid(Object v,
Node node,
Field field)
|
String |
toString()
|
String |
toString(Node node,
Field field)
|
boolean |
valid(Object v,
Node node,
Field field)
This function should contain the actual logic of the restriction. |
protected Collection |
validate(Collection errors,
Object v,
Node node,
Field field)
This method is called by BasicDataType.validate(Object, Node, Field) for each of its conditions. |
protected String |
valueString(Node node,
Field field)
If value of a a restriction depends on node, field, then you can override this |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected final String name
protected final BasicDataType parent
protected LocalizedString errorDescription
protected Serializable value
protected boolean fixed
protected int enforceStrength
protected BasicDataType.StaticAbstractRestriction absoluteParent
DataType.ENFORCE_ABSOLUTE.
| Constructor Detail |
protected BasicDataType.StaticAbstractRestriction(BasicDataType parent,
BasicDataType.StaticAbstractRestriction source)
protected BasicDataType.StaticAbstractRestriction(BasicDataType parent,
String name,
Serializable value)
| Method Detail |
public String getName()
getName in interface DataType.Restrictionpublic Serializable getValue()
DataType.Restriction
getValue in interface DataType.Restrictionpublic void setValue(Serializable v)
setValue in interface DataType.Restrictionpublic LocalizedString getErrorDescription()
DataType.Restriction
getErrorDescription in interface DataType.Restrictionpublic void setErrorDescription(LocalizedString errorDescription)
setErrorDescription in interface DataType.Restrictionpublic boolean isFixed()
public void setFixed(boolean fixed)
DataType.Restriction
setFixed in interface DataType.Restriction
protected final Collection addError(Collection errors,
Object v,
Node node,
Field field)
protected String valueString(Node node,
Field field)
protected final boolean enforce(Node node,
Field field)
validate(java.util.Collection, java.lang.Object, org.mmbase.bridge.Node, org.mmbase.bridge.Field) must enforce this condition
protected Collection validate(Collection errors,
Object v,
Node node,
Field field)
BasicDataType.validate(Object, Node, Field) for each of its conditions.
public final boolean valid(Object v,
Node node,
Field field)
DataType.Restriction
valid in interface DataType.Restrictionv - The value to check the restriction fornode - Some constrainst may need the Node.field - Some constrainst may need the Field.
protected abstract boolean simpleValid(Object v,
Node node,
Field field)
protected final void inherit(BasicDataType.StaticAbstractRestriction source,
boolean cast)
protected final void inherit(BasicDataType.StaticAbstractRestriction source)
public int getEnforceStrength()
DataType.RestrictionDataType.ENFORCE_ALWAYS, DataType.ENFORCE_ONCHANGE, DataType.ENFORCE_NEVER.
getEnforceStrength in interface DataType.Restrictionpublic void setEnforceStrength(int e)
setEnforceStrength in interface DataType.Restrictionpublic final String toString()
public final String toString(Node node,
Field field)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||