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_TRUEEMPTY_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, validateaddField, addField, addField, canonicalXPath, convert, getFieldsCount, getNamespace, hasField, hasFields, newInstance, toStringdecode, encode, getHelper, getName, getSchema, getSchemaName, getSuperType, getTypeHierarchy, isAny, isAnyType, isListType, isNotNull, isReadOnly, isSimpleType, isSuperTypeOf, setNotNull, setReadOnlyequals, getClass, hashCode, notify, notifyAll, wait, wait, waitaddSchema, addSchema, getSchema, getSchemaByPrefix, getSchemaNames, getSchemas, hasSchema, hasSchemasaddField, addField, addField, addField, getField, getField, getFields, getFieldsCount, getNamespace, hasField, hasField, hasFieldsdecode, encode, getHelper, getName, getSchema, getSchemaName, getSuperType, getTypeHierarchy, isAnyType, isComplexType, isCompositeType, isListType, isNotNull, isReadOnly, isSimpleType, isSuperTypeOf, newInstance, validateconvertpublic 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)
DocumentTypeThe 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 DocumentTypepublic PrefetchInfo getPrefetchInfo()
DocumentTypeIf 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 DocumentTypepublic 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 ComplexTypeisUnstructured in class ComplexTypeImplpublic boolean isFile()
DocumentTypeisFile in interface DocumentTypepublic boolean isFolder()
DocumentTypeisFolder in interface DocumentTypepublic boolean isOrdered()
DocumentTypeisOrdered in interface DocumentTypepublic Set<String> getFacets()
DocumentTypeFacets inherited from parents are taken into account.
getFacets in interface DocumentTypepublic void addSchemas(String[] schemas)
DocumentTypeaddSchemas in interface DocumentTypepublic void setDeclaredFacets(String[] facets)
setDeclaredFacets in interface DocumentTypepublic TypeRef<DocumentType> getRef()
TypegetRef in interface DocumentTypegetRef in interface ComplexTypegetRef in interface CompositeTypegetRef in interface TypegetRef in class CompositeTypeImplpublic String[] getChildrenTypes()
DocumentTypeReturned types may include special group of types like '*'.
getChildrenTypes in interface DocumentTypepublic void setChildrenTypes(String[] subTypes)
DocumentTypeChildren 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 DocumentTypesubTypes - null if no children types have been defined
(i.e. this type cannot have children), else an array with children typespublic DocumentType[] getResolvedChildrenTypes()
DocumentTypeSpecial 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 DocumentTypepublic boolean isChildTypeAllowed(String name)
isChildTypeAllowed in interface DocumentTypeCopyright © 2011 Nuxeo SA. All Rights Reserved.