Package org.nuxeo.ecm.core.schema.types
Class PrimitiveType
- java.lang.Object
-
- org.nuxeo.ecm.core.schema.types.AbstractType
-
- org.nuxeo.ecm.core.schema.types.PrimitiveType
-
- All Implemented Interfaces:
Serializable
,SimpleType
,Type
- Direct Known Subclasses:
BinaryType
,BooleanType
,DateType
,DoubleType
,IntegerType
,LongType
,StringType
public abstract class PrimitiveType extends AbstractType implements SimpleType
Primitive type (basic types like long, string, boolean, etc.).- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.nuxeo.ecm.core.schema.types.AbstractType
constraints, EMPTY_SUPERTYPES, name, schema, superType
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PrimitiveType(String name)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Set<Constraint>
getConstraints()
ObjectResolver
getObjectResolver()
Provides aObjectResolver
if this type is a reference to an external entity.PrimitiveType
getPrimitiveType()
Type
getSuperType()
Gets the super type.Type[]
getTypeHierarchy()
Gets the entire hierarchy of super-types.boolean
isPrimitive()
Tests whether this type is a primitive type.boolean
isSimpleType()
Tests whether this type is a simple type.abstract boolean
support(Class<? extends Constraint> constraint)
abstract boolean
validate(Object object)
Tests whether the given object is of this type.-
Methods inherited from class org.nuxeo.ecm.core.schema.types.AbstractType
addConstraints, decode, encode, getName, getSchema, getSchemaName, isAny, isAnyType, isComplexType, isCompositeType, isListType, isSuperTypeOf, newInstance, 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
convert, decode, encode, getName, getSchema, getSchemaName, isAnyType, isComplexType, isCompositeType, isListType, isSuperTypeOf, newInstance
-
-
-
-
Constructor Detail
-
PrimitiveType
protected PrimitiveType(String name)
-
-
Method Detail
-
validate
public abstract boolean validate(Object object)
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
-
getObjectResolver
public ObjectResolver 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.
-
getSuperType
public Type getSuperType()
Description copied from interface:Type
Gets the super type.- Specified by:
getSuperType
in interfaceType
- Overrides:
getSuperType
in classAbstractType
- Returns:
- the super type or null if this is a primitive type
-
getTypeHierarchy
public Type[] 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
- Overrides:
getTypeHierarchy
in classAbstractType
- Returns:
- an array containing the supertypes of this type
-
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
-
getPrimitiveType
public PrimitiveType getPrimitiveType()
- Specified by:
getPrimitiveType
in interfaceSimpleType
-
support
public abstract boolean support(Class<? extends Constraint> constraint)
- Returns:
- true if this primitive types supports this constraints, false otherwise.
- Since:
- 7.1
-
getConstraints
public Set<Constraint> getConstraints()
- Specified by:
getConstraints
in interfaceType
- Overrides:
getConstraints
in classAbstractType
- Returns:
- this type's constraints
-
-