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 theObjType
in this schema with the given storage ID.getObjType
(String typeName) Get theObjType
in this schema with the given name.Get all of theObjType
s 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.int
Get the schema index associated with this instance.Get the originalSchemaModel
on which this instance is based as it is recorded in the database.getSchemaModel
(boolean withStorageIds) Get theSchemaModel
on which this instance is based, optionally including explicit storage ID assignments.boolean
isEmpty()
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 originalSchemaModel
on which this instance is based as it is recorded in the database.Equivalent to:
getSchemaModel(boolean)
(false)
.- Returns:
- schema model
-
getSchemaModel
Get theSchemaModel
on which this instance is based, optionally including explicit storage ID assignments.If
withStorageIds
is 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 theObjType
s that constitute this schema, indexed by type name. -
getObjType
Get theObjType
in this schema with the given name.- Parameters:
typeName
- object type name- Returns:
- the corresponding
ObjType
- Throws:
UnknownTypeException
- if no suchObjType
existsIllegalArgumentException
- iftypeName
is null
-
getObjType
Get theObjType
in this schema with the given storage ID.- Parameters:
storageId
- object type storage ID- Returns:
- the corresponding
ObjType
- Throws:
UnknownTypeException
- if no suchObjType
existsIllegalArgumentException
- ifstorageId
is invalid
-
toString
-