org.mmbase.datatypes
Interface DataType.Restriction

All Superinterfaces:
Serializable
All Known Implementing Classes:
BasicDataType.StaticAbstractRestriction
Enclosing interface:
DataType

public static interface DataType.Restriction
extends Serializable

A restriction controls (one aspect of) the acceptable values of a DataType. A DataType generally has several restrictions.


Method Summary
 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)
 void setEnforceStrength(int v)
           
 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 value)
           
 boolean valid(Object value, Node node, Field field)
          This function should contain the actual logic of the restriction.
 

Method Detail

getName

public String getName()
Warning: No Java Documentation Available.

getValue

public 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)


setValue

public void setValue(Serializable value)
Warning: No Java Documentation Available.

getErrorDescription

public LocalizedString getErrorDescription()
If the restriction does not hold, the following error description can be used. On default these descriptions are searched in a resource bundle based on the name of this restriction.


setErrorDescription

public void setErrorDescription(LocalizedString errorDescription)
Warning: No Java Documentation Available.

valid

public boolean valid(Object value,
                     Node node,
                     Field field)
This function should contain the actual logic of the restriction. This does not consider the 'enforceStrength' (that is only used in the containing DataType implementation).

Parameters:
value - The value to check the restriction for
node - Some constrainst may need the Node.
field - Some constrainst may need the Field.
Returns:
Whether the supplied value is a valid value for this restriction.

setFixed

public void setFixed(boolean fixed)
If a restriction is 'fixed', the value and error-description cannot be changed any more.


getEnforceStrength

public int getEnforceStrength()
See DataType.ENFORCE_ALWAYS, DataType.ENFORCE_ONCHANGE, DataType.ENFORCE_NEVER.


setEnforceStrength

public void setEnforceStrength(int v)
Warning: No Java Documentation Available.


MMBase build 1.8.1.20060716