Package org.nuxeo.ecm.core.schema.types
Class SimpleTypeImpl
java.lang.Object
org.nuxeo.ecm.core.schema.types.AbstractType
org.nuxeo.ecm.core.schema.types.SimpleTypeImpl
- All Implemented Interfaces:
Serializable
,SimpleType
,Type
Implementation of a simple type that is not primitive (and therefore has constraints).
- See Also:
-
Field Summary
Fields inherited from class org.nuxeo.ecm.core.schema.types.AbstractType
constraints, EMPTY_SUPERTYPES, name, schema, superType
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionConverts the given value to an object compatible with the associated type.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.Provides aObjectResolver
if this type is a reference to an external entity.boolean
Tests whether this type is a primitive type.boolean
Tests whether this type is a simple type.Creates a new instance according to this type and filled with default values.void
setResolver
(ObjectResolver resolver) boolean
Tests whether the given object is of this type.Methods inherited from class org.nuxeo.ecm.core.schema.types.AbstractType
addConstraints, getConstraints, getName, getSchema, getSchemaName, getSuperType, getTypeHierarchy, isAny, isAnyType, isComplexType, isCompositeType, isListType, isSuperTypeOf, validateConstraints
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.nuxeo.ecm.core.schema.types.Type
getConstraints, getName, getSchema, getSchemaName, getSuperType, getTypeHierarchy, isAnyType, isComplexType, isCompositeType, isListType, isSuperTypeOf
-
Constructor Details
-
SimpleTypeImpl
-
-
Method Details
-
validate
Description copied from interface:Type
Tests whether the given object is of this type.- Specified by:
validate
in interfaceType
- Overrides:
validate
in classAbstractType
- 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
-
getPrimitiveType
- Specified by:
getPrimitiveType
in interfaceSimpleType
-
isPrimitive
public boolean isPrimitive()Description copied from interface:SimpleType
Tests whether this type is a primitive type.- Specified by:
isPrimitive
in interfaceSimpleType
- Returns:
- true if this type is a primitive type, false otherwise
-
isSimpleType
public boolean isSimpleType()Description copied from interface:Type
Tests whether this type is a simple type.- Specified by:
isSimpleType
in interfaceType
- Overrides:
isSimpleType
in classAbstractType
- Returns:
- true if this type is a simple type, false otherwise
-
setResolver
-
getObjectResolver
Description copied from interface:Type
Provides aObjectResolver
if this type is a reference to an external entity.- Specified by:
getObjectResolver
in interfaceType
- Overrides:
getObjectResolver
in classAbstractType
- Returns:
- a resolver if available, null otherwise.
-
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.
- Specified by:
decode
in interfaceType
- Overrides:
decode
in classAbstractType
- Parameters:
str
- 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
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 interfaceType
- Overrides:
encode
in classAbstractType
- Parameters:
value
- the object to convert- Returns:
- the string representation of the given object or null if object cannot be converted
-
convert
Description copied from interface:Type
Converts the given value to an object compatible with the associated type.- Specified by:
convert
in interfaceType
- Parameters:
value
- the value to convert- Returns:
- the converted value
- Throws:
TypeException
- if the value to convert is not compatible with the associated type
-
newInstance
Description copied from interface:Type
Creates a new instance according to this type and filled with default values.- Specified by:
newInstance
in interfaceType
- Overrides:
newInstance
in classAbstractType
-