Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.core.schema.types
Class AbstractType

java.lang.Object
  extended by org.nuxeo.ecm.core.schema.types.AbstractType
All Implemented Interfaces:
Serializable, Type, ValueConverter
Direct Known Subclasses:
AnyType, ComplexTypeImpl, ListTypeImpl, PrimitiveType, SimpleTypeImpl

public abstract class AbstractType
extends Object
implements Type

Author:
Bogdan Stefanescu
See Also:
Serialized Form

Field Summary
static Type[] EMPTY_SUPERTYPES
           
static int F_NOTNULL
           
static int F_READONLY
           
 
Fields inherited from interface org.nuxeo.ecm.core.schema.types.Type
ANY
 
Method Summary
 Object decode(String string)
          Decodes the string representation into an object of this type.
 String encode(Object object)
          Encodes the given object that is assumed to be of this type into a string representation.
 TypeHelper getHelper()
          Get the type helper.
 String getName()
          Gets the name of this type.
 TypeRef<? extends Type> getRef()
          Gets a proxy (or reference to this type).
 Schema getSchema()
          Gets the schema defining this type.
 String getSchemaName()
          Gets the local name of this type.
 Type getSuperType()
          Gets the super type.
 Type[] getTypeHierarchy()
          Gets the entire hierarchy of super-types.
 boolean isAny()
           
 boolean isAnyType()
          Tests whether this type is the ANY type.
 boolean isComplexType()
          Tests whether this type is a complex type.
 boolean isCompositeType()
          Tests whether this is a composite type.
 boolean isListType()
          Tests whether this type is a list type.
 boolean isNotNull()
          Tests whether this type supports null values.
 boolean isReadOnly()
          Tests whether this type is read-only.
 boolean isSimpleType()
          Tests whether this type is a simple type.
 boolean isSuperTypeOf(Type type)
          Tests whether the given type is derived from this type.
 Object newInstance()
          Creates a new instance according to this type and filled with default values.
 void setNotNull(boolean val)
           
 void setReadOnly(boolean val)
           
 boolean validate(Object object)
          Tests whether the given object is of this type.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.nuxeo.ecm.core.schema.types.ValueConverter
convert
 

Field Detail

EMPTY_SUPERTYPES

public static final Type[] EMPTY_SUPERTYPES

F_READONLY

public static final int F_READONLY
See Also:
Constant Field Values

F_NOTNULL

public static final int F_NOTNULL
See Also:
Constant Field Values
Method Detail

getRef

public TypeRef<? extends Type> getRef()
Description copied from interface: Type
Gets a proxy (or reference to this type).

Specified by:
getRef in interface Type
Returns:
a reference to the type

getHelper

public TypeHelper getHelper()
Description copied from interface: Type
Get the type helper. Must never return null

The type helper is used to handle operations on value of that type.

Specified by:
getHelper in interface Type
Returns:
the type helper

getSuperType

public Type getSuperType()
Description copied from interface: Type
Gets the super type.

Specified by:
getSuperType in interface Type
Returns:
the super type or null if this is a primitive type

getName

public String getName()
Description copied from interface: Type
Gets the name of this type.

Specified by:
getName in interface Type
Returns:
the type name

getSchemaName

public String getSchemaName()
Description copied from interface: Type
Gets the local name of this type.

Specified by:
getSchemaName in interface Type
Returns:
the local name

getSchema

public Schema getSchema()
Description copied from interface: Type
Gets the schema defining this type.

Specified by:
getSchema in interface Type
Returns:

isSuperTypeOf

public boolean isSuperTypeOf(Type type)
Description copied from interface: Type
Tests whether the given type is derived from this type.

Specified by:
isSuperTypeOf in interface Type
Parameters:
type - the type to test
Returns:
true if the given type is derived from this type, false otherwise

isAny

public boolean isAny()

getTypeHierarchy

public Type[] getTypeHierarchy()
Description copied from interface: Type
Gets the entire hierarchy of super-types.

The array is ordered as follows:

The returned array is never null. An empty array is returned in the case of ANY type.

Specified by:
getTypeHierarchy in interface Type
Returns:
an array containing the supertypes of this type

isSimpleType

public boolean isSimpleType()
Description copied from interface: Type
Tests whether this type is a simple type.

Specified by:
isSimpleType in interface Type
Returns:
true if this type is a simple type, false otherwise

isComplexType

public boolean isComplexType()
Description copied from interface: Type
Tests whether this type is a complex type.

Specified by:
isComplexType in interface Type
Returns:
true if this type is a complex type, false otherwise

isListType

public boolean isListType()
Description copied from interface: Type
Tests whether this type is a list type.

Specified by:
isListType in interface Type
Returns:
true if is a list type, false otherwise

isAnyType

public boolean isAnyType()
Description copied from interface: Type
Tests whether this type is the ANY type.

Specified by:
isAnyType in interface Type
Returns:
true if it is the ANY type, false otherwise

isCompositeType

public boolean isCompositeType()
Description copied from interface: Type
Tests whether this is a composite type.

Specified by:
isCompositeType in interface Type
Returns:
true if this is a composite type, false otherwise

isNotNull

public boolean isNotNull()
Description copied from interface: Type
Tests whether this type supports null values.

Specified by:
isNotNull in interface Type
Returns:
false if an object of this type can be null, true otherwise

isReadOnly

public boolean isReadOnly()
Description copied from interface: Type
Tests whether this type is read-only.

Specified by:
isReadOnly in interface Type
Returns:
true if an object of this type cannot be modified, false otherwise

validate

public boolean validate(Object object)
                 throws TypeException
Description copied from interface: Type
Tests whether the given object is of this type.

Specified by:
validate in interface Type
Parameters:
object - the object to test
Returns:
true if the given object if of this type, false otherwise
Throws:
TypeException - if an error occurs trying to retrieve the supertypes

setNotNull

public void setNotNull(boolean val)

setReadOnly

public void setReadOnly(boolean val)

decode

public Object decode(String string)
Description copied from interface: Type
Decodes the string representation into an object of this type.

Returns null if the string can not be decoded.

Specified by:
decode in interface Type
Parameters:
string - the string to decode
Returns:
the converted object that can be use as a value for an object of this type or null if the given object cannot be converted

encode

public String encode(Object object)
Description copied from interface: Type
Encodes the given object that is assumed to be of this type into a string representation.

Null is returned if the object cannot be converted.

Specified by:
encode in interface Type
Parameters:
object - the object to convert
Returns:
the string representation of the given object or null if object cannot be converted

newInstance

public Object newInstance()
Description copied from interface: Type
Creates a new instance according to this type and filled with default values.

Specified by:
newInstance in interface Type
Returns:

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.