Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.core.schema.types
Interface Type

All Superinterfaces:
Serializable, ValueConverter
All Known Subinterfaces:
ComplexType, CompositeType, DocumentType, ListType, Schema, SimpleType
All Known Implementing Classes:
AbstractType, AnyType, BinaryType, BooleanType, ComplexTypeImpl, CompositeTypeImpl, DateType, DocumentTypeImpl, DoubleType, IntegerType, ListTypeImpl, LongType, PrimitiveType, SchemaImpl, SimpleTypeImpl, StringType

public interface Type
extends Serializable, ValueConverter

A Type object is used to describe some ECM content.

There are two groups of content types:

Custom types are structured in two groups: The typing system is mainly inspired from XML schemas.

There is a root type called ANY type.
Apart this special type, each type has a super type (a type from which it is derived)

On top of this typing system there are two high level content types:

Type names must not contains a : character. This character may be used internally to prefix the type name so it must not be used in the type name.

Author:
Bogdan Stefanescu

Field Summary
static AnyType 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 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.
 boolean validate(Object object)
          Tests whether the given object is of this type.
 
Methods inherited from interface org.nuxeo.ecm.core.schema.types.ValueConverter
convert
 

Field Detail

ANY

static final AnyType ANY
Method Detail

getName

String getName()
Gets the name of this type.

Returns:
the type name

getSchemaName

String getSchemaName()
Gets the local name of this type.

Returns:
the local name

getSchema

Schema getSchema()
Gets the schema defining this type.

Returns:

getHelper

TypeHelper getHelper()
Get the type helper. Must never return null

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

Returns:
the type helper

getRef

TypeRef<? extends Type> getRef()
Gets a proxy (or reference to this type).

Returns:
a reference to the type

getSuperType

Type getSuperType()
Gets the super type.

Returns:
the super type or null if this is a primitive type

getTypeHierarchy

Type[] getTypeHierarchy()
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.

Returns:
an array containing the supertypes of this type

isSuperTypeOf

boolean isSuperTypeOf(Type type)
Tests whether the given type is derived from this type.

Parameters:
type - the type to test
Returns:
true if the given type is derived from this type, false otherwise

isSimpleType

boolean isSimpleType()
Tests whether this type is a simple type.

Returns:
true if this type is a simple type, false otherwise

isComplexType

boolean isComplexType()
Tests whether this type is a complex type.

Returns:
true if this type is a complex type, false otherwise

isListType

boolean isListType()
Tests whether this type is a list type.

Returns:
true if is a list type, false otherwise

isAnyType

boolean isAnyType()
Tests whether this type is the ANY type.

Returns:
true if it is the ANY type, false otherwise

isCompositeType

boolean isCompositeType()
Tests whether this is a composite type.

Returns:
true if this is a composite type, false otherwise

isNotNull

boolean isNotNull()
Tests whether this type supports null values.

Returns:
false if an object of this type can be null, true otherwise

isReadOnly

boolean isReadOnly()
Tests whether this type is read-only.

Returns:
true if an object of this type cannot be modified, false otherwise

validate

boolean validate(Object object)
                 throws TypeException
Tests whether the given object is of this 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

decode

Object decode(String string)
Decodes the string representation into an object of this type.

Returns null if the string can not be decoded.

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

String encode(Object object)
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.

Parameters:
object - the object to convert
Returns:
the string representation of the given object or null if object cannot be converted

newInstance

Object newInstance()
Creates a new instance according to this type and filled with default values.

Returns:

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.