|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.mmbase.datatypes.BasicDataType.StaticAbstractRestriction<D>
protected abstract static class BasicDataType.StaticAbstractRestriction<D extends Serializable>
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 D |
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,
D value)
|
| Method Summary | |
|---|---|
protected Collection<LocalizedString> |
addError(Collection<LocalizedString> 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(Object v,
Node node,
Field field)
Whether validate(java.util.Collection 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. |
protected String |
getErrorDescriptionBundle()
|
String |
getName()
|
D |
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)
Set enforce strength |
void |
setErrorDescription(LocalizedString errorDescription)
Set error description for this restriction |
void |
setFixed(boolean fixed)
If a restriction is 'fixed', the value and error-description cannot be changed any more. |
void |
setValue(D v)
Set the Value describing the restriction |
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<LocalizedString> |
validate(Collection<LocalizedString> 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 D extends 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,
D value)
| Method Detail |
|---|
public String getName()
getName in interface DataType.Restriction<D extends Serializable>public D getValue()
DataType.Restriction
getValue in interface DataType.Restriction<D extends Serializable>public void setValue(D v)
DataType.Restriction
setValue in interface DataType.Restriction<D extends Serializable>v - The instanc for the Valueprotected String getErrorDescriptionBundle()
public LocalizedString getErrorDescription()
DataType.Restriction
getErrorDescription in interface DataType.Restriction<D extends Serializable>public void setErrorDescription(LocalizedString errorDescription)
DataType.Restriction
setErrorDescription in interface DataType.Restriction<D extends Serializable>errorDescription - description of errorpublic boolean isFixed()
public void setFixed(boolean fixed)
DataType.Restriction
setFixed in interface DataType.Restriction<D extends Serializable>
protected final Collection<LocalizedString> addError(Collection<LocalizedString> errors,
Object v,
Node node,
Field field)
protected String valueString(Node node,
Field field)
protected final boolean enforce(Object v,
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<LocalizedString> validate(Collection<LocalizedString> 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.Restriction<D extends Serializable>v - 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.Restriction<D extends Serializable>public void setEnforceStrength(int e)
DataType.Restriction
setEnforceStrength in interface DataType.Restriction<D extends Serializable>e - value of DataType.ENFORCE_ALWAYS, DataType.ENFORCE_ONCHANGE, DataType.ENFORCE_NEVER.public final String toString()
toString in class Object
public final String toString(Node node,
Field field)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||