Package io.permazen.core
Class Schema
java.lang.Object
io.permazen.core.Schema
Reflects a
SchemaModel as recorded in a Database as seen by a particular Transaction.
Instances are immutable and thread safe.
-
Method Summary
Modifier and TypeMethodDescriptiongetObjType(int storageId) Get theObjTypein this schema with the given storage ID.getObjType(String typeName) Get theObjTypein this schema with the given name.Get all of theObjTypes that constitute this schema, indexed by type name.Get the schema bundle that this instance is a member of.Get the schema ID associated with this instance.intGet the schema index associated with this instance.Get the originalSchemaModelon which this instance is based as it is recorded in the database.getSchemaModel(boolean withStorageIds) Get theSchemaModelon which this instance is based, optionally including explicit storage ID assignments.booleanisEmpty()Determine whether this schema is empty, i.e., contains zero object types.toString()
-
Method Details
-
isEmpty
public boolean isEmpty()Determine whether this schema is empty, i.e., contains zero object types.Empty schemas are not recorded in the database.
- Returns:
- true if empty, otherwise false
-
getSchemaBundle
Get the schema bundle that this instance is a member of.- Returns:
- the containing schema bundle
-
getSchemaIndex
public int getSchemaIndex()Get the schema index associated with this instance.- Returns:
- schema index, or zero if this is the empty schema
-
getSchemaId
Get the schema ID associated with this instance.- Returns:
- schema ID
-
getSchemaModel
Get the originalSchemaModelon which this instance is based as it is recorded in the database.Equivalent to:
getSchemaModel(boolean)(false).- Returns:
- schema model
-
getSchemaModel
Get theSchemaModelon which this instance is based, optionally including explicit storage ID assignments.If
withStorageIdsis true, then all of the schema items in the returned model will have non-zero storage ID's reflecting their storage ID assignments in the database.- Parameters:
withStorageIds- true to include all storage ID assignments, false for the original model- Returns:
- schema model with storage ID assignments
-
getObjTypes
Get all of theObjTypes that constitute this schema, indexed by type name. -
getObjType
Get theObjTypein this schema with the given name.- Parameters:
typeName- object type name- Returns:
- the corresponding
ObjType - Throws:
UnknownTypeException- if no suchObjTypeexistsIllegalArgumentException- iftypeNameis null
-
getObjType
Get theObjTypein this schema with the given storage ID.- Parameters:
storageId- object type storage ID- Returns:
- the corresponding
ObjType - Throws:
UnknownTypeException- if no suchObjTypeexistsIllegalArgumentException- ifstorageIdis invalid
-
toString
-