public interface Type extends Serializable
There are two groups of content types:
.+@.+
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:
:
character. This character may be used internally to prefix the type
name so it must not be used in the type name.Modifier and Type | Method and Description |
---|---|
Object |
convert(Object value)
Converts the given value to an object compatible with the associated type.
|
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.
|
Set<Constraint> |
getConstraints() |
String |
getName()
Gets the name of this type.
|
ObjectResolver |
getObjectResolver()
Provides a
ObjectResolver if this type is a reference to an external entity. |
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 |
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.
|
String getSchemaName()
Type getSuperType()
Type[] getTypeHierarchy()
The array is ordered as follows:
The returned array is never null. An empty array is returned in the case of ANY
type.
boolean isSuperTypeOf(Type type)
type
- the type to testboolean isSimpleType()
boolean isComplexType()
boolean isListType()
boolean isAnyType()
boolean isCompositeType()
boolean validate(Object object) throws TypeException
object
- the object to testTypeException
- if an error occurs trying to retrieve the supertypesObject decode(String string)
Returns null if the string can not be decoded.
string
- the string to decodeString encode(Object object)
Null is returned if the object cannot be converted.
object
- the object to convertObject newInstance()
Object convert(Object value) throws TypeException
value
- the value to convertTypeException
- if the value to convert is not compatible with the associated typeSet<Constraint> getConstraints()
ObjectResolver getObjectResolver()
ObjectResolver
if this type is a reference to an external entity.Copyright © 2018 Nuxeo. All rights reserved.