public class SimpleTypeImpl extends AbstractType implements SimpleType
constraints, EMPTY_SUPERTYPES, name, schema, superType
Constructor and Description |
---|
SimpleTypeImpl(SimpleType superType,
String schema,
String 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 str)
Decodes the string representation into an object of this type.
|
String |
encode(Object value)
Encodes the given object that is assumed to be of this type into a string representation.
|
ObjectResolver |
getObjectResolver()
Provides a
ObjectResolver if this type is a reference to an external entity. |
PrimitiveType |
getPrimitiveType() |
boolean |
isPrimitive()
Tests whether this type is a primitive type.
|
boolean |
isSimpleType()
Tests whether this type is a simple type.
|
Object |
newInstance()
Creates a new instance according to this type and filled with default values.
|
void |
setResolver(ObjectResolver resolver) |
boolean |
validate(Object object)
Tests whether the given object is of this type.
|
addConstraints, getConstraints, getName, getSchema, getSchemaName, getSuperType, getTypeHierarchy, isAny, isAnyType, isComplexType, isCompositeType, isListType, isSuperTypeOf, validateConstraints
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getConstraints, getName, getSchema, getSchemaName, getSuperType, getTypeHierarchy, isAnyType, isComplexType, isCompositeType, isListType, isSuperTypeOf
public SimpleTypeImpl(SimpleType superType, String schema, String name)
public boolean validate(Object object) throws TypeException
Type
validate
in interface Type
validate
in class AbstractType
object
- the object to testTypeException
- if an error occurs trying to retrieve the supertypespublic PrimitiveType getPrimitiveType()
getPrimitiveType
in interface SimpleType
public boolean isPrimitive()
SimpleType
isPrimitive
in interface SimpleType
public boolean isSimpleType()
Type
isSimpleType
in interface Type
isSimpleType
in class AbstractType
public void setResolver(ObjectResolver resolver)
public ObjectResolver getObjectResolver()
Type
ObjectResolver
if this type is a reference to an external entity.getObjectResolver
in interface Type
getObjectResolver
in class AbstractType
public Object decode(String str)
Type
Returns null if the string can not be decoded.
decode
in interface Type
decode
in class AbstractType
str
- the string to decodepublic String encode(Object value)
Type
Null is returned if the object cannot be converted.
encode
in interface Type
encode
in class AbstractType
value
- the object to convertpublic Object convert(Object value) throws TypeException
Type
convert
in interface Type
value
- the value to convertTypeException
- if the value to convert is not compatible with the associated typepublic Object newInstance()
Type
newInstance
in interface Type
newInstance
in class AbstractType
Copyright © 2017 Nuxeo. All rights reserved.