Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.core.schema.types
Class CompositeTypeImpl

java.lang.Object
  extended by org.nuxeo.ecm.core.schema.types.AbstractType
      extended by org.nuxeo.ecm.core.schema.types.ComplexTypeImpl
          extended by org.nuxeo.ecm.core.schema.types.CompositeTypeImpl
All Implemented Interfaces:
Serializable, ComplexType, CompositeType, Type, ValueConverter
Direct Known Subclasses:
DocumentTypeImpl

public class CompositeTypeImpl
extends ComplexTypeImpl
implements CompositeType

Author:
Bogdan Stefanescu
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.nuxeo.ecm.core.schema.types.ComplexTypeImpl
F_UNSTRUCT_DEFAULT, F_UNSTRUCT_FALSE, F_UNSTRUCT_TRUE
 
Fields inherited from class org.nuxeo.ecm.core.schema.types.AbstractType
EMPTY_SUPERTYPES, F_NOTNULL, F_READONLY
 
Fields inherited from interface org.nuxeo.ecm.core.schema.types.Type
ANY
 
Constructor Summary
CompositeTypeImpl(CompositeType superType, String schema, String name, String[] schemas)
           
CompositeTypeImpl(TypeRef<? extends CompositeType> superType, String schema, String name, String[] schemas)
           
 
Method Summary
 Field addField(QName name, TypeRef<? extends Type> type)
          Adds a field to this complex type.
 void addSchema(Schema schema)
          Adds a schema.
 void addSchema(String schema)
          Adds a schema.
 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.
 TypeRef<? extends CompositeType> getRef()
          Gets a proxy (or reference to this type).
 Schema getSchema(String name)
          Gets the composite type schema given its name.
 Schema getSchemaByPrefix(String prefix)
          Finds the composite type schema given the schema prefix.
 String[] getSchemaNames()
          Gets the schema names of this type.
 Collection<Schema> getSchemas()
          Gets all the schemas (including inherited schemas) of this composite type.
 boolean hasField(QName name)
          Tests whether this type defines the given field name.
 boolean hasSchema(String name)
          Checks if this composite type has the given schema.
 boolean hasSchemas()
          Checks if this composite type has any schema defined.
 boolean isComplexType()
          Tests whether this type is a complex type.
 boolean isCompositeType()
          Tests whether this is a composite type.
 boolean validate(Object object)
          Tests whether the given object is of this type.
 
Methods inherited from class org.nuxeo.ecm.core.schema.types.ComplexTypeImpl
addField, addField, addField, canonicalXPath, convert, getFieldsCount, getNamespace, hasField, hasFields, isUnstructured, newInstance, toString
 
Methods inherited from class org.nuxeo.ecm.core.schema.types.AbstractType
decode, encode, getHelper, getName, getSchema, getSchemaName, getSuperType, getTypeHierarchy, isAny, isAnyType, isListType, isNotNull, isReadOnly, isSimpleType, isSuperTypeOf, setNotNull, setReadOnly
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.nuxeo.ecm.core.schema.types.ComplexType
addField, addField, addField, getFieldsCount, getNamespace, hasField, hasFields, isUnstructured
 
Methods inherited from interface org.nuxeo.ecm.core.schema.types.Type
decode, encode, getHelper, getName, getSchema, getSchemaName, getSuperType, getTypeHierarchy, isAnyType, isListType, isNotNull, isReadOnly, isSimpleType, isSuperTypeOf, newInstance
 
Methods inherited from interface org.nuxeo.ecm.core.schema.types.ValueConverter
convert
 

Constructor Detail

CompositeTypeImpl

public CompositeTypeImpl(CompositeType superType,
                         String schema,
                         String name,
                         String[] schemas)

CompositeTypeImpl

public CompositeTypeImpl(TypeRef<? extends CompositeType> superType,
                         String schema,
                         String name,
                         String[] schemas)
Method Detail

hasSchemas

public final boolean hasSchemas()
Description copied from interface: CompositeType
Checks if this composite type has any schema defined.

Specified by:
hasSchemas in interface CompositeType
Returns:
true if this composite type has some schemas defined, false otherwise

addSchema

public final void addSchema(String schema)
Description copied from interface: CompositeType
Adds a schema.

Specified by:
addSchema in interface CompositeType
Parameters:
schema - the schema name to add

addSchema

public final void addSchema(Schema schema)
Description copied from interface: CompositeType
Adds a schema.

Specified by:
addSchema in interface CompositeType
Parameters:
schema - the schema to add

getSchema

public final Schema getSchema(String name)
Description copied from interface: CompositeType
Gets the composite type schema given its name.

Specified by:
getSchema in interface CompositeType
Parameters:
name - the schema name
Returns:
the schema if any or null if none was found

getSchemaByPrefix

public final Schema getSchemaByPrefix(String prefix)
Description copied from interface: CompositeType
Finds the composite type schema given the schema prefix.

Specified by:
getSchemaByPrefix in interface CompositeType
Parameters:
prefix - the schema prefix
Returns:
the schema if any or null if none was found

hasSchema

public final boolean hasSchema(String name)
Description copied from interface: CompositeType
Checks if this composite type has the given schema.

Specified by:
hasSchema in interface CompositeType
Parameters:
name - the schema name
Returns:
true if the composite type has this schema, false otherwise

getSchemaNames

public final String[] getSchemaNames()
Description copied from interface: CompositeType
Gets the schema names of this type.

Specified by:
getSchemaNames in interface CompositeType
Returns:
the schema names

getSchemas

public final Collection<Schema> getSchemas()
Description copied from interface: CompositeType
Gets all the schemas (including inherited schemas) of this composite type.

Specified by:
getSchemas in interface CompositeType
Returns:
the composite type schemas

addField

public final Field addField(QName name,
                            TypeRef<? extends Type> type)
Description copied from interface: ComplexType
Adds a field to this complex type.

Specified by:
addField in interface ComplexType
Overrides:
addField in class ComplexTypeImpl
Parameters:
name - the field name
type - the field type
Returns:
the created field

getField

public final Field getField(String name)
Description copied from interface: ComplexType
Gets the field with the given name.

If 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.

Specified by:
getField in interface ComplexType
Overrides:
getField in class ComplexTypeImpl
Parameters:
name - the field name
Returns:
the field

getField

public final Field getField(QName name)
Description copied from interface: ComplexType
Gets the field having the given name.

Specified by:
getField in interface ComplexType
Overrides:
getField in class ComplexTypeImpl
Parameters:
name - the name
Returns:
the field or null if no field with that name was found

hasField

public final boolean hasField(QName name)
Description copied from interface: ComplexType
Tests whether this type defines the given field name.

Specified by:
hasField in interface ComplexType
Overrides:
hasField in class ComplexTypeImpl
Parameters:
name - the field name
Returns:
true if the field exists, false otherwise

getFields

public final Collection<Field> getFields()
Description copied from interface: ComplexType
Gets all fields as a (field name, field type) map.

Specified by:
getFields in interface ComplexType
Overrides:
getFields in class ComplexTypeImpl
Returns:
the fields map

isComplexType

public final boolean isComplexType()
Description copied from interface: Type
Tests whether this type is a complex type.

Specified by:
isComplexType in interface Type
Overrides:
isComplexType in class ComplexTypeImpl
Returns:
true if this type is a complex type, false otherwise

isCompositeType

public final boolean isCompositeType()
Description copied from interface: Type
Tests whether this is a composite type.

Specified by:
isCompositeType in interface Type
Overrides:
isCompositeType in class AbstractType
Returns:
true if this is a composite type, false otherwise

validate

public final boolean validate(Object object)
Description copied from interface: Type
Tests whether the given object is of this type.

Specified by:
validate in interface Type
Overrides:
validate in class ComplexTypeImpl
Parameters:
object - the object to test
Returns:
true if the given object if of this type, false otherwise

getRef

public TypeRef<? extends CompositeType> getRef()
Description copied from interface: Type
Gets a proxy (or reference to this type).

Specified by:
getRef in interface ComplexType
Specified by:
getRef in interface CompositeType
Specified by:
getRef in interface Type
Overrides:
getRef in class ComplexTypeImpl
Returns:
a reference to the type

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.