public abstract class AbstractType extends Object implements Type
Modifier and Type | Field and Description |
---|---|
protected Set<Constraint> |
constraints |
static Type[] |
EMPTY_SUPERTYPES |
protected String |
name |
protected String |
schema |
protected Type |
superType |
Modifier | Constructor and Description |
---|---|
protected |
AbstractType(Type superType,
String schema,
String name) |
Modifier and Type | Method and Description |
---|---|
void |
addConstraints(Collection<Constraint> constraints) |
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 |
isAny() |
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.
|
protected boolean |
validateConstraints(Object object) |
public static final Type[] EMPTY_SUPERTYPES
protected Set<Constraint> constraints
protected AbstractType(Type superType, String schema, String name)
public Type getSuperType()
Type
getSuperType
in interface Type
public String getSchemaName()
Type
getSchemaName
in interface Type
public Schema getSchema()
Type
public boolean isSuperTypeOf(Type type)
Type
isSuperTypeOf
in interface Type
type
- the type to testpublic boolean isAny()
public Type[] getTypeHierarchy()
Type
The array is ordered as follows:
The returned array is never null. An empty array is returned in the case of ANY
type.
getTypeHierarchy
in interface Type
public boolean isSimpleType()
Type
isSimpleType
in interface Type
public boolean isComplexType()
Type
isComplexType
in interface Type
public boolean isListType()
Type
isListType
in interface Type
public boolean isAnyType()
Type
public boolean isCompositeType()
Type
isCompositeType
in interface Type
public boolean validate(Object object) throws TypeException
Type
validate
in interface Type
object
- the object to testTypeException
- if an error occurs trying to retrieve the supertypespublic Object decode(String string)
Type
Returns null if the string can not be decoded.
public String encode(Object object)
Type
Null is returned if the object cannot be converted.
public Object newInstance()
Type
newInstance
in interface Type
public Set<Constraint> getConstraints()
getConstraints
in interface Type
public void addConstraints(Collection<Constraint> constraints)
protected boolean validateConstraints(Object object)
public ObjectResolver getObjectResolver()
Type
ObjectResolver
if this type is a reference to an external entity.getObjectResolver
in interface Type
Copyright © 2018 Nuxeo. All rights reserved.