public class DocumentTypeImpl extends CompositeTypeImpl implements DocumentType
This class uses lazy loading for schemas and field types.
Schemas and fields are cached to improve lookups time.
Modifier and Type | Field and Description |
---|---|
static int |
T_DOCUMENT |
static int |
T_FOLDER |
static int |
T_ORDERED |
F_UNSTRUCT_DEFAULT, F_UNSTRUCT_FALSE, F_UNSTRUCT_TRUE
EMPTY_SUPERTYPES, F_NOTNULL, F_READONLY
Constructor and Description |
---|
DocumentTypeImpl(DocumentType superType,
String name) |
DocumentTypeImpl(DocumentType superType,
String name,
String[] declaredSchemas) |
DocumentTypeImpl(DocumentType superType,
String name,
String[] declaredSchemas,
String[] declaredFacets) |
DocumentTypeImpl(TypeRef<DocumentType> superType,
String name) |
DocumentTypeImpl(TypeRef<DocumentType> superType,
String name,
String[] declaredSchemas) |
DocumentTypeImpl(TypeRef<DocumentType> superType,
String name,
String[] declaredSchemas,
String[] facets) |
DocumentTypeImpl(TypeRef<DocumentType> superType,
String name,
String[] declaredSchemas,
String[] facets,
int flags) |
Modifier and Type | Method and Description |
---|---|
void |
addSchemas(String[] schemas)
Adds specified schemas to the document type.
|
String[] |
getChildrenTypes()
Gets the type names that can be used for children docs.
|
Set<String> |
getFacets()
Gets all the facets of this document type.
|
PrefetchInfo |
getPrefetchInfo()
Gets the prefetch info, or null if no prefetch is defined.
|
TypeRef<DocumentType> |
getRef()
Gets a proxy (or reference to this type).
|
DocumentType[] |
getResolvedChildrenTypes()
Gets the resolved children doc types.
|
boolean |
isChildTypeAllowed(String name) |
boolean |
isFile()
Tests whether this type describes a document (not a folder!) or not.
|
boolean |
isFolder()
Tests whether this type describes a folder or not.
|
boolean |
isOrdered()
Tests whether this type describe an ordered folder or not.
|
boolean |
isUnstructured()
Tests whether this type is structured or not.
|
void |
setChildrenTypes(String[] subTypes)
Sets the names of the allowed children doc types.
|
void |
setDeclaredFacets(String[] facets) |
void |
setPrefetchInfo(PrefetchInfo prefetchInfo)
Sets the prefetch info.
|
addField, addSchema, addSchema, getField, getField, getFields, getSchema, getSchemaByPrefix, getSchemaNames, getSchemas, hasField, hasSchema, hasSchemas, isComplexType, isCompositeType, validate
addField, addField, addField, canonicalXPath, convert, getFieldsCount, getNamespace, hasField, hasFields, newInstance, toString
decode, encode, getHelper, getName, getSchema, getSchemaName, getSuperType, getTypeHierarchy, isAny, isAnyType, isListType, isNotNull, isReadOnly, isSimpleType, isSuperTypeOf, setNotNull, setReadOnly
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
addSchema, addSchema, getSchema, getSchemaByPrefix, getSchemaNames, getSchemas, hasSchema, hasSchemas
addField, addField, addField, addField, getField, getField, getFields, getFieldsCount, getNamespace, hasField, hasField, hasFields
decode, encode, getHelper, getName, getSchema, getSchemaName, getSuperType, getTypeHierarchy, isAnyType, isComplexType, isCompositeType, isListType, isNotNull, isReadOnly, isSimpleType, isSuperTypeOf, newInstance, validate
convert
public static final int T_DOCUMENT
public static final int T_FOLDER
public static final int T_ORDERED
public DocumentTypeImpl(DocumentType superType, String name)
public DocumentTypeImpl(DocumentType superType, String name, String[] declaredSchemas)
public DocumentTypeImpl(DocumentType superType, String name, String[] declaredSchemas, String[] declaredFacets)
public DocumentTypeImpl(TypeRef<DocumentType> superType, String name)
public DocumentTypeImpl(TypeRef<DocumentType> superType, String name, String[] declaredSchemas)
public DocumentTypeImpl(TypeRef<DocumentType> superType, String name, String[] declaredSchemas, String[] facets)
public DocumentTypeImpl(TypeRef<DocumentType> superType, String name, String[] declaredSchemas, String[] facets, int flags)
public void setPrefetchInfo(PrefetchInfo prefetchInfo)
DocumentType
The prefetch info describes which fields (or entire schemas) should be prefetched when instantiating a document.
This is primarily intended to optimize document initialization time.
The prefetch info is a string array of length multiple of 2 containing a sequence of pairs
composed by the schema name and the field name. If the field name is null then the entire schema
should be prefetched. Example: "common", null, "dublincore", "title"
setPrefetchInfo
in interface DocumentType
public PrefetchInfo getPrefetchInfo()
DocumentType
If the prefetch info is not null, the caller should use it when instantiating a document to preload the fields defined by the prefetch info.
If no prefetch is specified by the document type, the caller is free to use a default prefetch info or no prefetch at all.
getPrefetchInfo
in interface DocumentType
public boolean isUnstructured()
ComplexType
An 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 ComplexType
isUnstructured
in class ComplexTypeImpl
public boolean isFile()
DocumentType
isFile
in interface DocumentType
public boolean isFolder()
DocumentType
isFolder
in interface DocumentType
public boolean isOrdered()
DocumentType
isOrdered
in interface DocumentType
public Set<String> getFacets()
DocumentType
Facets inherited from parents are taken into account.
getFacets
in interface DocumentType
public void addSchemas(String[] schemas)
DocumentType
addSchemas
in interface DocumentType
public void setDeclaredFacets(String[] facets)
setDeclaredFacets
in interface DocumentType
public TypeRef<DocumentType> getRef()
Type
getRef
in interface DocumentType
getRef
in interface ComplexType
getRef
in interface CompositeType
getRef
in interface Type
getRef
in class CompositeTypeImpl
public String[] getChildrenTypes()
DocumentType
Returned types may include special group of types like '*'.
getChildrenTypes
in interface DocumentType
public void setChildrenTypes(String[] subTypes)
DocumentType
Children types are document types allowed for the children of a document of the current type.
Type names may include '*' for all types.
setChildrenTypes
in interface DocumentType
subTypes
- null if no children types have been defined
(i.e. this type cannot have children), else an array with children typespublic DocumentType[] getResolvedChildrenTypes()
DocumentType
Special group of types like '*' and exclusion filters if any are applied and the set of actual children types is computed and resolved into real doc types.
getResolvedChildrenTypes
in interface DocumentType
public boolean isChildTypeAllowed(String name)
isChildTypeAllowed
in interface DocumentType
Copyright © 2011 Nuxeo SA. All Rights Reserved.