Package org.nuxeo.ecm.core.schema.types
Class AbstractType
java.lang.Object
org.nuxeo.ecm.core.schema.types.AbstractType
- All Implemented Interfaces:
Serializable
,Type
- Direct Known Subclasses:
AnyType
,ComplexTypeImpl
,ListTypeImpl
,PrimitiveType
,SimpleTypeImpl
Abstract (common) implementation for a Type.
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addConstraints
(Collection<Constraint> constraints) Decodes the string representation into an object of this type.Encodes the given object that is assumed to be of this type into a string representation.getName()
Gets the name of this type.Provides aObjectResolver
if this type is a reference to an external entity.Gets the schema defining this type.Gets the local name of this type.Gets the super type.Type[]
Gets the entire hierarchy of super-types.boolean
isAny()
boolean
Tests whether this type is the ANY type.boolean
Tests whether this type is a complex type.boolean
Tests whether this is a composite type.boolean
Tests whether this type is a list type.boolean
Tests whether this type is a simple type.boolean
isSuperTypeOf
(Type type) Tests whether the given type is derived from this type.Creates a new instance according to this type and filled with default values.boolean
Tests whether the given object is of this type.protected boolean
validateConstraints
(Object object)
-
Field Details
-
EMPTY_SUPERTYPES
-
name
-
schema
-
superType
-
constraints
-
-
Constructor Details
-
AbstractType
-
-
Method Details
-
getSuperType
Description copied from interface:Type
Gets the super type.- Specified by:
getSuperType
in interfaceType
- Returns:
- the super type or null if this is a primitive type
-
getName
Description copied from interface:Type
Gets the name of this type. -
getSchemaName
Description copied from interface:Type
Gets the local name of this type.- Specified by:
getSchemaName
in interfaceType
- Returns:
- the local name
-
getSchema
Description copied from interface:Type
Gets the schema defining this type. -
isSuperTypeOf
Description copied from interface:Type
Tests whether the given type is derived from this type.- Specified by:
isSuperTypeOf
in interfaceType
- Parameters:
type
- the type to test- Returns:
- true if the given type is derived from this type, false otherwise
-
isAny
public boolean isAny() -
getTypeHierarchy
Description copied from interface:Type
Gets the entire hierarchy of super-types.The array is ordered as follows:
- the direct super type is the first element,
- the super super type is the second element,
- and so on.
The returned array is never null. An empty array is returned in the case of
ANY
type.- Specified by:
getTypeHierarchy
in interfaceType
- 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 interfaceType
- 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 interfaceType
- 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 interfaceType
- 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. -
isCompositeType
public boolean isCompositeType()Description copied from interface:Type
Tests whether this is a composite type.- Specified by:
isCompositeType
in interfaceType
- Returns:
- true if this is a composite type, false otherwise
-
validate
Description copied from interface:Type
Tests whether the given object is of this type.- Specified by:
validate
in interfaceType
- 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
Description copied from interface:Type
Decodes the string representation into an object of this type.Returns null if the string can not be decoded.
-
encode
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.
-
newInstance
Description copied from interface:Type
Creates a new instance according to this type and filled with default values.- Specified by:
newInstance
in interfaceType
-
getConstraints
- Specified by:
getConstraints
in interfaceType
- Returns:
- this type's constraints
-
addConstraints
-
validateConstraints
-
getObjectResolver
Description copied from interface:Type
Provides aObjectResolver
if this type is a reference to an external entity.- Specified by:
getObjectResolver
in interfaceType
- Returns:
- a resolver if available, null otherwise.
-