protected abstract static class BasicDataType.StaticAbstractRestriction<D extends Serializable> extends Object implements DataType.Restriction<D>
| Modifier and Type | Field and Description |
|---|---|
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 |
| Modifier | Constructor and Description |
|---|---|
protected |
StaticAbstractRestriction(BasicDataType<?> parent,
BasicDataType.StaticAbstractRestriction<?> source)
Instantaties new restriction for a clone of the parent DataType.
|
protected |
StaticAbstractRestriction(BasicDataType<?> parent,
String name,
D value) |
| Modifier and Type | Method and Description |
|---|---|
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<org.mmbase.util.LocalizedString>, java.lang.Object, org.mmbase.bridge.Node, org.mmbase.bridge.Field) must enforce this condition |
int |
getEnforceStrength()
|
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
|
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.protected StaticAbstractRestriction(BasicDataType<?> parent, BasicDataType.StaticAbstractRestriction<?> source)
protected StaticAbstractRestriction(BasicDataType<?> parent, String name, D value)
public String getName()
getName in interface DataType.Restriction<D extends Serializable>public D getValue()
DataType.RestrictiongetValue in interface DataType.Restriction<D extends Serializable>public void setValue(D v)
DataType.RestrictionsetValue in interface DataType.Restriction<D extends Serializable>v - The instanc for the Valueprotected String getErrorDescriptionBundle()
public LocalizedString getErrorDescription()
DataType.RestrictiongetErrorDescription in interface DataType.Restriction<D extends Serializable>public void setErrorDescription(LocalizedString errorDescription)
DataType.RestrictionsetErrorDescription in interface DataType.Restriction<D extends Serializable>errorDescription - description of errorpublic boolean isFixed()
public void setFixed(boolean fixed)
DataType.RestrictionsetFixed 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<org.mmbase.util.LocalizedString>, java.lang.Object, org.mmbase.bridge.Node, org.mmbase.bridge.Field) must enforce this conditionprotected 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.Restrictionvalid 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 final void inherit(BasicDataType.StaticAbstractRestriction<?> source, boolean cast)
protected final void inherit(BasicDataType.StaticAbstractRestriction<?> source)
public int getEnforceStrength()
DataType.RestrictiongetEnforceStrength in interface DataType.Restriction<D extends Serializable>public void setEnforceStrength(int e)
DataType.RestrictionsetEnforceStrength in interface DataType.Restriction<D extends Serializable>e - value of DataType.ENFORCE_ALWAYS, DataType.ENFORCE_ONCHANGE, DataType.ENFORCE_NEVER.MMBase 1.9-SNAPSHOT - ${javadoctimestamp}