org.mmbase.datatypes
Interface LengthDataType

All Superinterfaces:
Cloneable, Comparable, DataType, Descriptor, Serializable
All Known Implementing Classes:
AbstractLengthDataType, StringDataType

public interface LengthDataType
extends DataType

A LengthDataType is a datatype that defines a length for its values (getLength(Object)) , and restrictions on that (minimal an maximal length). Sometimes you may think 'size' in stead of length, but we think that there is is not much difference between those...

Since:
MMBase-1.8
Version:
$Id: LengthDataType.java,v 1.4 2005/11/23 12:11:25 michiel Exp $
Author:
Pierre van Rooden, Michiel Meeuwissen

Nested Class Summary
 
Nested classes inherited from class org.mmbase.datatypes.DataType
DataType.Restriction
 
Field Summary
 
Fields inherited from interface org.mmbase.datatypes.DataType
ENFORCE_ABSOLUTE, ENFORCE_ALWAYS, ENFORCE_NEVER, ENFORCE_ONCHANGE, ENFORCE_ONCREATE, PROCESS_GET, PROCESS_SET, VALID, XMLNS
 
Method Summary
 long getLength(Object value)
          In this method should be implemented how to calculate such a length for a certain value of this datatype.
 long getMaxLength()
          Returns the maximum length of binary values for this datatype.
 DataType.Restriction getMaxLengthRestriction()
          Returns the 'maxLength' restriction, containing the value, errormessages, and fixed status of this attribute.
 long getMinLength()
          Returns the minimum length of binary values for this datatype.
 DataType.Restriction getMinLengthRestriction()
          Returns the 'minLength' restriction, containing the value, errormessages, and fixed status of this attribute.
 void setMaxLength(long value)
          Sets the maximum length of binary values for this datatype.
 void setMinLength(long value)
          Sets the minimum length of binary values for this datatype.
 
Methods inherited from interface org.mmbase.datatypes.DataType
cast, checkType, clone, clone, finish, getBaseType, getBaseTypeIdentifier, getCommitProcessor, getDefaultValue, getEnumerationFactory, getEnumerationRestriction, getEnumerationValue, getEnumerationValues, getOrigin, getProcessor, getProcessor, getRequiredRestriction, getTypeAsClass, getUniqueRestriction, inherit, isFinished, isRequired, isUnique, preCast, rewrite, setCommitProcessor, setDefaultValue, setProcessor, setProcessor, setRequired, setUnique, toXml, toXml, validate, validate
 
Methods inherited from interface org.mmbase.bridge.Descriptor
getDescription, getDescription, getGUIName, getGUIName, getLocalizedDescription, getLocalizedGUIName, getName, setDescription, setDescription, setGUIName, setGUIName
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

getLength

public long getLength(Object value)
In this method should be implemented how to calculate such a length for a certain value of this datatype. There does not exist a generic interface for this, so the implementation will cast to the expected type (String, byte[]..)


getMinLength

public long getMinLength()
Returns the minimum length of binary values for this datatype.

Returns:
the minimum length as an int, or 0 if there is no minimum length.

getMinLengthRestriction

public DataType.Restriction getMinLengthRestriction()
Returns the 'minLength' restriction, containing the value, errormessages, and fixed status of this attribute.

Returns:
the restriction as a DataType.Restriction

setMinLength

public void setMinLength(long value)
Sets the minimum length of binary values for this datatype.

Parameters:
value - the minimum length as an long, or 0 if there is no minimum length.
Throws:
Class - Identifier: java.lang.UnsupportedOperationException if this datatype is finished

getMaxLength

public long getMaxLength()
Returns the maximum length of binary values for this datatype.

Returns:
the maximum length as an long, or a very very big value (Long.MAX_VALUE) if there is no maximum length.

getMaxLengthRestriction

public DataType.Restriction getMaxLengthRestriction()
Returns the 'maxLength' restriction, containing the value, errormessages, and fixed status of this attribute.

Returns:
the restriction as a DataType.Restriction

setMaxLength

public void setMaxLength(long value)
Sets the maximum length of binary values for this datatype.

Parameters:
value - see getMaxLength()
Throws:
Class - Identifier: java.lang.UnsupportedOperationException if this datatype is finished


MMBase build 1.8.1.20060716