org.mmbase.datatypes
Class BinaryDataType

Package class diagram package BinaryDataType
java.lang.Object
  extended by org.mmbase.bridge.util.AbstractDescriptor
      extended by org.mmbase.datatypes.BasicDataType<E>
          extended by org.mmbase.datatypes.AbstractLengthDataType<InputStream>
              extended by 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

Nested Class Summary
protected  class BinaryDataType.MimeTypeRestriction
           
 
Nested classes/interfaces inherited from class org.mmbase.datatypes.AbstractLengthDataType
AbstractLengthDataType.MaxRestriction, AbstractLengthDataType.MinRestriction
 
Nested classes/interfaces inherited from class org.mmbase.datatypes.BasicDataType
BasicDataType.AbstractRestriction<D extends Serializable>, BasicDataType.DataTypeComparator<D>, BasicDataType.EnumerationRestriction, BasicDataType.RequiredRestriction, BasicDataType.RestrictedEnumerationIterator, BasicDataType.StaticAbstractRestriction<D extends Serializable>, BasicDataType.TypeRestriction, BasicDataType.UniqueRestriction
 
Nested classes/interfaces inherited from interface org.mmbase.datatypes.DataType
DataType.Restriction<D extends Serializable>
 
Field Summary
protected  BinaryDataType.MimeTypeRestriction mimeTypeRestriction
           
 
Fields inherited from class org.mmbase.datatypes.AbstractLengthDataType
maxLengthRestriction, minLengthRestriction
 
Fields inherited from class org.mmbase.datatypes.BasicDataType
DATATYPE_BUNDLE, defaultValue, enumerationRestriction, origin, requiredRestriction, typeRestriction, uniqueRestriction
 
Fields inherited from class org.mmbase.bridge.util.AbstractDescriptor
description, guiName, key
 
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
 
Constructor Summary
BinaryDataType(String name)
          Constructor for binary field.
 
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.bridge.util.AbstractDescriptor
getDefaultLocale, getDescription, getDescription, getGUIName, getGUIName, getLocalizedDescription, getLocalizedGUIName, getName, setDescription, setDescription, setGUIName, setGUIName, setLocalizedDescription, setLocalizedGUIName
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
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
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

mimeTypeRestriction

protected BinaryDataType.MimeTypeRestriction mimeTypeRestriction
Constructor Detail

BinaryDataType

public BinaryDataType(String name)
Constructor for binary field.

Parameters:
name - the name of the data type
Method Detail

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)


MMBase2 Bridge 2.0-SNAPSHOT - 2013-03-30T06:34