org.mmbase.datatypes
Interface LengthDataType<E>

All Superinterfaces:
Comparable<DataType<E>>, DataType<E>, Descriptor, Serializable
All Known Implementing Classes:
AbstractLengthDataType, BinaryDataType, BinaryStringDataType, CaptchaDataType, CheckEqualityDataType, ComponentNamesDataType, ConfirmPasswordDataType, DecimalDataType, InternetAddressDataType, LanguageDataType, ListDataType, NodeManagerNamesDataType, SecurityContextDataType, Setting.DataType, StringDataType, UniqueStringDataType, XmlDataType

public interface LengthDataType<E>
extends DataType<E>

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 40071 2009-12-01 17:57:48Z michiel $
Author:
Pierre van Rooden, Michiel Meeuwissen

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.mmbase.datatypes.DataType
DataType.Restriction<D extends Serializable>
 
Field Summary
 
Fields inherited from interface org.mmbase.datatypes.DataType
ENFORCE_ABSOLUTE, ENFORCE_ALWAYS, ENFORCE_NEVER, ENFORCE_ONCHANGE, ENFORCE_ONCREATE, ENFORCE_ONVALIDATE, 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 values for this datatype.
 DataType.Restriction<Long> getMaxLengthRestriction()
          Returns the 'maxLength' restriction, containing the value, errormessages, and fixed status of this attribute.
 long getMinLength()
          Returns the minimum length of values for this datatype.
 DataType.Restriction<Long> getMinLengthRestriction()
          Returns the 'minLength' restriction, containing the value, errormessages, and fixed status of this attribute.
 void setMaxLength(long value)
          Sets the maximum length of 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, castAndValidate, castForSearch, castOrException, checkType, clone, clone, finish, getBaseType, getBaseTypeIdentifier, getCommitProcessor, getDefaultValue, getDefaultValue, getDeleteProcessor, getEnforceStrength, getEnumerationFactory, getEnumerationRestriction, getEnumerationValue, getEnumerationValues, getHandler, getHandlers, getOrigin, getProcessor, getProcessor, getRequiredRestriction, getStyleClasses, getTypeAsClass, getUniqueRestriction, 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

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

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

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

getMinLengthRestriction

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

Returns:
the restriction as a DataType.Restriction

setMinLength

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<T> - Identifier: java.lang.UnsupportedOperationException if this datatype is finished

getMaxLength

long getMaxLength()
Returns the maximum length of 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

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

Returns:
the restriction as a DataType.Restriction

setMaxLength

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

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


MMBase 2.0-SNAPSHOT - null