Package io.permazen.schema
Class SchemaObjectType
java.lang.Object
io.permazen.util.AbstractXMLStreaming
io.permazen.schema.SchemaItem
io.permazen.schema.SchemaObjectType
- All Implemented Interfaces:
DiffGenerating<SchemaObjectType>
,Cloneable
One object type in a
SchemaModel
.-
Field Summary
Fields inherited from class io.permazen.schema.SchemaItem
NAME_PATTERN
Fields inherited from class io.permazen.util.AbstractXMLStreaming
log
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Deep-clone this instance.Detect the differences of this instance when compared to the given instance.boolean
final ItemType
Get theItemType
corresponding to this instance.Get theSchemaCompositeIndex
s defined on this object type's fields, indexed by name.int
Get the schema epoch included in the calculation ofSchemaSupport.getSchemaId()
.Get this object type'sSchemaField
s, indexed by name.final SchemaId
Generate a uniqueSchemaId
corresponding to the type and encoding structure of this schema item.int
hashCode()
final boolean
isLockedDown
(boolean includingStorageIds) Determine whether this instance is locked down.static SchemaId
schemaIdForName
(String name) Get theSchemaId
for an object type with the given name.void
setSchemaEpoch
(int schemaEpoch) Set the schema epoch included in the calculation ofSchemaSupport.getSchemaId()
.toString()
final <T extends SchemaItem>
voidvisitSchemaItems
(Class<T> nodeType, Consumer<? super T> visitor) Visit this schema item and all of its descendents matching the given type with the given visitor.void
visitSchemaItems
(Consumer<? super SchemaItem> visitor) Visit allSchemaItem
descendents of this instance with the given visitor.Methods inherited from class io.permazen.schema.SchemaItem
differencesFrom, getName, getStorageId, setName, setStorageId
Methods inherited from class io.permazen.util.AbstractXMLStreaming
expect, expectClose, getAttr, getAttr, getBooleanAttr, getBooleanAttr, getIntAttr, getIntAttr, getLongAttr, newInvalidAttributeException, newInvalidInputException, newInvalidInputException, next, skip, writeAttr, writeCData, writeCharacters, writeElement, writeEmptyElement, writeStartElement
-
Field Details
-
ITEM_TYPE
TheItemType
that this class represents.
-
-
Constructor Details
-
SchemaObjectType
public SchemaObjectType()
-
-
Method Details
-
getSchemaFields
Get this object type'sSchemaField
s, indexed by name.- Returns:
- fields in this object type
-
getSchemaCompositeIndexes
Get theSchemaCompositeIndex
s defined on this object type's fields, indexed by name.- Returns:
- composite indexes in this object type
-
getSchemaEpoch
public int getSchemaEpoch()Get the schema epoch included in the calculation ofSchemaSupport.getSchemaId()
.- Returns:
SchemaModel
schema ID epoch
-
setSchemaEpoch
public void setSchemaEpoch(int schemaEpoch) Set the schema epoch included in the calculation ofSchemaSupport.getSchemaId()
.- Parameters:
schemaEpoch
-SchemaModel
schema ID epoch
-
visitSchemaItems
Visit allSchemaItem
descendents of this instance with the given visitor.If this instance is also a
SchemaItem
, then also visit this instance.The traversal is depth first, pre-order.
- Parameters:
visitor
- visitor for schema items
-
schemaIdForName
Get theSchemaId
for an object type with the given name.Object type schema ID's depend only on the object type name.
- Parameters:
name
- object type name- Returns:
- corresponding schema ID
- Throws:
IllegalArgumentException
- ifname
is null
-
getItemType
Get theItemType
corresponding to this instance.- Returns:
- schema item type
-
differencesFrom
Description copied from interface:DiffGenerating
Detect the differences of this instance when compared to the given instance.- Specified by:
differencesFrom
in interfaceDiffGenerating<SchemaObjectType>
- Parameters:
that
- other instance- Returns:
- differences; will be empty if there are none detected
-
toString
- Specified by:
toString
in classSchemaItem
-
equals
- Overrides:
equals
in classSchemaItem
-
hashCode
public int hashCode()- Overrides:
hashCode
in classSchemaItem
-
clone
Deep-clone this instance.The returned instance will not be locked down even if this one is.
- Overrides:
clone
in classSchemaItem
-
visitSchemaItems
public final <T extends SchemaItem> void visitSchemaItems(Class<T> nodeType, Consumer<? super T> visitor) Visit this schema item and all of its descendents matching the given type with the given visitor.The traversal is depth first, post-order.
- Parameters:
nodeType
- node type to includevisitor
- visitor for schema items- Throws:
IllegalArgumentException
- if either parameter is null
-
isLockedDown
public final boolean isLockedDown(boolean includingStorageIds) Determine whether this instance is locked down.- Parameters:
includingStorageIds
- false to test all but storage ID's, true to require storage ID's to be locked down as well- Returns:
- true if instance is locked down, otherwise false
-
getSchemaId
Generate a uniqueSchemaId
corresponding to the type and encoding structure of this schema item.The
SchemaId
does not depend on the storage ID.This instance must be locked down except for storage ID's. Repeated invocations of this method will be very fast, just returning the cached previous result.
- Returns:
- schema ID
- Throws:
IllegalStateException
- if this instance is not locked down- See Also:
-