org.mmbase.datatypes
Class BinaryDataType
java.lang.Object
org.mmbase.core.AbstractDescriptor
org.mmbase.datatypes.BasicDataType<E>
org.mmbase.datatypes.AbstractLengthDataType<InputStream>
org.mmbase.datatypes.BinaryDataType
- All Implemented Interfaces:
- Serializable, Cloneable, Comparable<DataType<InputStream>>, Descriptor, DataType<InputStream>, LengthDataType<InputStream>, PublicCloneable<AbstractDescriptor>
public class BinaryDataType
- extends AbstractLengthDataType<InputStream>
The datatype associated with byte arrays ('blobs').
- Since:
- MMBase-1.8
- Version:
- $Id: BinaryDataType.java 41969 2010-04-20 11:54:02Z michiel $
- Author:
- Pierre van Rooden
- See Also:
- Serialized Form
|
Method Summary |
protected InputStream |
cast(Object value,
Cloud cloud,
Node node,
Field field)
Utility to avoid repetitive calling of getCloud |
protected String |
castToPresent(Object value,
Node node,
Field field)
If the value must be shown, e.g. |
protected void |
cloneRestrictions(BasicDataType origin)
If a datatype is cloned, the restrictions of it (normally implemented as inner classes), must be reinstantiated. |
long |
getLength(Object value)
In this method should be implemented how to calculate such a length for a certain value of
this datatype. |
MimeType |
getMimeType(Object value,
Node node,
Field field)
|
Pattern |
getValidMimeTypes()
Returns a regular expression which describes wich mime-types are valid for blobs with this
DataType. |
void |
setValidMimeTypes(Pattern pattern)
|
protected Collection<LocalizedString> |
validateCastValue(Collection<LocalizedString> errors,
Object castValue,
Object value,
Node node,
Field field)
|
protected Collection<LocalizedString> |
validateRequired(Collection<LocalizedString> errors,
Object castValue,
Object value,
Node node,
Field field)
|
| Methods inherited from class org.mmbase.datatypes.AbstractLengthDataType |
getEnforceStrength, getMaxLength, getMaxLengthRestriction, getMinLength, getMinLengthRestriction, inheritRestrictions, setMaxLength, setMinLength, toStringBuilder, toXml, validateCastValueOrNull |
| Methods inherited from class org.mmbase.datatypes.BasicDataType |
addErrorDescription, addRestriction, addRestriction, addStyleClass, cast, castAndValidate, castForSearch, castOrException, castToValidate, checkType, clone, clone, compareTo, edit, equals, finish, finish, getBaseType, getBaseTypeIdentifier, getCloud, getCloud, getCommitProcessor, getComparator, getDefaultProcessor, getDefaultValue, getDefaultValue, getDeleteProcessor, getElement, getElement, getEnforceString, getEnumerationFactory, getEnumerationRestriction, getEnumerationValue, getEnumerationValues, getHandler, getHandlers, getOrigin, getProcessor, getProcessor, getProcessorWithoutDefault, getRequiredRestriction, getRestrictions, getStyleClasses, getTypeAsClass, getUniqueRestriction, hashCode, inherit, inheritProperties, isCorrectType, isFinished, isRequired, isUnique, preCast, preCast, preCast, rewrite, setCommitProcessor, setDefaultProcessor, setDefaultValue, setDeleteProcessor, setProcessor, setProcessor, setRequired, setUnique, setXml, toString, toXml, validate, validate, xmlValue |
| Methods inherited from class org.mmbase.core.AbstractDescriptor |
getDefaultLocale, getDescription, getDescription, getGUIName, getGUIName, getLocalizedDescription, getLocalizedGUIName, getName, setDescription, setDescription, setGUIName, setGUIName, setLocalizedDescription, setLocalizedGUIName |
| Methods inherited from interface org.mmbase.datatypes.DataType |
cast, castAndValidate, castForSearch, castOrException, checkType, clone, clone, finish, getBaseType, getBaseTypeIdentifier, getCommitProcessor, getDefaultValue, getDefaultValue, getDeleteProcessor, 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, validate, validate |
| Methods inherited from interface org.mmbase.bridge.Descriptor |
getDescription, getDescription, getGUIName, getGUIName, getLocalizedDescription, getLocalizedGUIName, getName, setDescription, setDescription, setGUIName, setGUIName |
mimeTypeRestriction
protected BinaryDataType.MimeTypeRestriction mimeTypeRestriction
BinaryDataType
public BinaryDataType(String name)
- Constructor for binary field.
- Parameters:
name - the name of the data type
castToPresent
protected String castToPresent(Object value,
Node node,
Field field)
- Description copied from class:
BasicDataType
- If the value must be shown, e.g. in error message, it passed through this method.
- Overrides:
castToPresent in class BasicDataType<InputStream>
cast
protected InputStream cast(Object value,
Cloud cloud,
Node node,
Field field)
throws CastException
- Description copied from class:
BasicDataType
- Utility to avoid repetitive calling of getCloud
- Overrides:
cast in class BasicDataType<InputStream>
- Throws:
CastException
cloneRestrictions
protected void cloneRestrictions(BasicDataType origin)
- Description copied from class:
BasicDataType
- If a datatype is cloned, the restrictions of it (normally implemented as inner classes), must be reinstantiated.
- Overrides:
cloneRestrictions in class AbstractLengthDataType<InputStream>
getLength
public long getLength(Object value)
- Description copied from class:
AbstractLengthDataType
- 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[]..)
- Specified by:
getLength in interface LengthDataType<InputStream>- Specified by:
getLength in class AbstractLengthDataType<InputStream>
getMimeType
public MimeType getMimeType(Object value,
Node node,
Field field)
- Since:
- MMBase-1.9.3
validateRequired
protected Collection<LocalizedString> validateRequired(Collection<LocalizedString> errors,
Object castValue,
Object value,
Node node,
Field field)
- Overrides:
validateRequired in class BasicDataType<InputStream>
validateCastValue
protected Collection<LocalizedString> validateCastValue(Collection<LocalizedString> errors,
Object castValue,
Object value,
Node node,
Field field)
- Overrides:
validateCastValue in class AbstractLengthDataType<InputStream>
getValidMimeTypes
public Pattern getValidMimeTypes()
- Returns a regular expression which describes wich mime-types are valid for blobs with this
DataType. This is not yet available as a Restriction, only as a property.
setValidMimeTypes
public void setValidMimeTypes(Pattern pattern)
MMBase 2.0-SNAPSHOT - null