public class ComplexTypeImpl extends AbstractType implements ComplexType
| Modifier and Type | Field and Description |
|---|---|
static int |
F_UNSTRUCT_DEFAULT |
static int |
F_UNSTRUCT_FALSE |
static int |
F_UNSTRUCT_TRUE |
EMPTY_SUPERTYPES, F_NOTNULL, F_READONLY| Constructor and Description |
|---|
ComplexTypeImpl(ComplexType superType,
String schema,
String name) |
ComplexTypeImpl(ComplexType superType,
String schema,
String name,
Namespace ns) |
ComplexTypeImpl(TypeRef<? extends ComplexType> superType,
String schema,
String name) |
ComplexTypeImpl(TypeRef<? extends ComplexType> superType,
String schema,
String name,
Namespace ns) |
ComplexTypeImpl(TypeRef<? extends ComplexType> superType,
String schema,
String name,
Namespace ns,
int struct) |
| Modifier and Type | Method and Description |
|---|---|
Field |
addField(QName name,
TypeRef<? extends Type> type)
Adds a field to this complex type.
|
Field |
addField(QName name,
TypeRef<? extends Type> type,
String defaultValue,
int flags)
Adds a field to this complex type.
|
Field |
addField(String name,
TypeRef<? extends Type> type)
Adds a field to this complex type.
|
Field |
addField(String name,
TypeRef<? extends Type> type,
String defaultValue,
int flags)
Adds a field to this complex type.
|
static String |
canonicalXPath(String xpath)
Canonicalizes a Nuxeo-xpath.
|
Object |
convert(Object object)
Converts the given value to an object compatible with the associated type.
|
Field |
getField(QName name)
Gets the field having the given name.
|
Field |
getField(String name)
Gets the field with the given name.
|
Collection<Field> |
getFields()
Gets all fields as a (field name, field type) map.
|
int |
getFieldsCount()
Gets the number of fields defined for this complex type.
|
Namespace |
getNamespace()
Gets the namespace used by this complex type.
|
TypeRef<? extends ComplexType> |
getRef()
Gets a proxy (or reference to this type).
|
boolean |
hasField(QName name)
Tests whether this type defines the given field name.
|
boolean |
hasField(String name)
Tests whether this type defines the given field name.
|
boolean |
hasFields()
Tests whether this type has any field defined.
|
boolean |
isComplexType()
Tests whether this type is a complex type.
|
boolean |
isUnstructured()
Tests whether this type is structured or not.
|
Map<String,Object> |
newInstance()
Creates a new instance according to this type and filled with default
values.
|
String |
toString() |
boolean |
validate(Object object)
Tests whether the given object is of this type.
|
decode, encode, getHelper, getName, getSchema, getSchemaName, getSuperType, getTypeHierarchy, isAny, isAnyType, isCompositeType, isListType, isNotNull, isReadOnly, isSimpleType, isSuperTypeOf, setNotNull, setReadOnlyequals, getClass, hashCode, notify, notifyAll, wait, wait, waitdecode, encode, getHelper, getName, getSchema, getSchemaName, getSuperType, getTypeHierarchy, isAnyType, isCompositeType, isListType, isNotNull, isReadOnly, isSimpleType, isSuperTypeOfpublic static final int F_UNSTRUCT_DEFAULT
public static final int F_UNSTRUCT_FALSE
public static final int F_UNSTRUCT_TRUE
public ComplexTypeImpl(TypeRef<? extends ComplexType> superType, String schema, String name, Namespace ns, int struct)
public ComplexTypeImpl(ComplexType superType, String schema, String name)
public ComplexTypeImpl(ComplexType superType, String schema, String name, Namespace ns)
public ComplexTypeImpl(TypeRef<? extends ComplexType> superType, String schema, String name)
public ComplexTypeImpl(TypeRef<? extends ComplexType> superType, String schema, String name, Namespace ns)
public Namespace getNamespace()
ComplexTypegetNamespace in interface ComplexTypeNamespace.DEFAULT_NS if none was
specifiedpublic boolean isUnstructured()
ComplexTypeAn unstructured complex type accepts any field name and type.
By default, complex types inherit their unstructured property. If a type has no super-type then it is considered unstructured if it is not specifying any field.
isUnstructured in interface ComplexTypepublic Field getField(String name)
ComplexTypeIf the name is non-prefixed the first matching field is returned if any is found. If the name is prefixed then the right field is returned if any is found.
getField in interface ComplexTypename - the field namepublic Field getField(QName name)
ComplexTypegetField in interface ComplexTypename - the namepublic Collection<Field> getFields()
ComplexTypegetFields in interface ComplexTypepublic int getFieldsCount()
ComplexTypegetFieldsCount in interface ComplexTypepublic Field addField(String name, TypeRef<? extends Type> type)
ComplexTypeIf the given name is not prefixed it will be prefixed with the type prefix. If one was specified otherwise the default prefix will be used (e.g. "" - no prefix). If the given name is prefixed it will be stored as is (using the specified prefix).
addField in interface ComplexTypename - the field nametype - the field typepublic Field addField(QName name, TypeRef<? extends Type> type)
ComplexTypeaddField in interface ComplexTypename - the field nametype - the field typepublic Field addField(String name, TypeRef<? extends Type> type, String defaultValue, int flags)
ComplexTypeIf the given name is not prefixed it will be prefixed with the type prefix. If one was specified otherwise the default prefix will be used (e.g. "" - no prefix). If the given name is prefixed it will be stored as is (using the specified prefix).
addField in interface ComplexTypename - the field nametype - the field typedefaultValue - an optional default value (null if none)flags - optional flagspublic Field addField(QName name, TypeRef<? extends Type> type, String defaultValue, int flags)
ComplexTypeaddField in interface ComplexTypename - the field nametype - the field typedefaultValue - an optional default value (null if none)flags - optional flags
Possible values are:
public boolean hasField(String name)
ComplexTypeThe name is supposed to be non prefixed.
hasField in interface ComplexTypename - the field namepublic boolean hasField(QName name)
ComplexTypehasField in interface ComplexTypename - the field namepublic boolean hasFields()
ComplexTypeIf a complex type has no fields, it is considered as unstructured and it accepts any field with any type and name.
hasFields in interface ComplexTypepublic boolean isComplexType()
TypeisComplexType in interface TypeisComplexType in class AbstractTypepublic boolean validate(Object object) throws TypeException
Typevalidate in interface Typevalidate in class AbstractTypeobject - the object to testTypeException - if an error occurs trying to retrieve the
supertypespublic Map<String,Object> newInstance()
TypenewInstance in interface TypenewInstance in class AbstractTypepublic Object convert(Object object) throws TypeException
ValueConverterconvert in interface ValueConverterobject - the value to convertTypeException - if the value to convert is not compatible with the associated typepublic TypeRef<? extends ComplexType> getRef()
TypegetRef in interface ComplexTypegetRef in interface TypegetRef in class AbstractTypeCopyright © 2011 Nuxeo SA. All Rights Reserved.