Package io.permazen.core
Class ReferenceField
A field that references another
Database
object.
Null values sort last.
Reference fields are always indexed.
-
Method Summary
Modifier and TypeMethodDescriptionGet theEncoding
associated with this field.Get the desired behavior when an object referred to by this field is deleted.Get the object types this field is allowed to reference, if so restricted.boolean
Determine whether this field accepts references to deleted objects in normal (non-detached) transactions.boolean
Determine whether the referred-to object should be deleted when an object containing this field is deleted.protected ObjId
remapObjectId
(ObjIdMap<ObjId> objectIdMap, ObjId srcId) protected boolean
toString()
<R> R
visit
(FieldSwitch<R> target) Apply visitor pattern.Methods inherited from class io.permazen.core.SimpleField
getCompositeIndexes, getFullName, getIndex, getParentField, getValue, hasDefaultValue, isIndexed, setValue
Methods inherited from class io.permazen.core.Field
getKey, getObjType, getTypeToken
Methods inherited from class io.permazen.core.SchemaItem
getName, getSchema, getSchemaId, getStorageId
-
Method Details
-
getEncoding
Description copied from class:SimpleField
Get theEncoding
associated with this field.- Overrides:
getEncoding
in classSimpleField<ObjId>
- Returns:
- this field's type
-
getInverseDelete
Get the desired behavior when an object referred to by this field is deleted.- Returns:
- desired behavior when a referenced object is deleted
-
isForwardDelete
public boolean isForwardDelete()Determine whether the referred-to object should be deleted when an object containing this field is deleted.- Returns:
- whether deletion should cascade to the referred-to object
-
isAllowDeleted
public boolean isAllowDeleted()Determine whether this field accepts references to deleted objects in normal (non-detached) transactions.- Returns:
- whether deleted objects are allowed in normal transactions
-
getObjectTypes
Get the object types this field is allowed to reference, if so restricted.- Returns:
- names of allowed object types, or null if there is no restriction
-
visit
Description copied from class:Field
Apply visitor pattern.- Overrides:
visit
in classSimpleField<ObjId>
- Type Parameters:
R
- visitor return type- Parameters:
target
- target to invoke- Returns:
- return value from the method of
target
corresponding to this instance's type
-
toString
- Overrides:
toString
in classSimpleField<ObjId>
-
remapsObjectId
protected boolean remapsObjectId()- Overrides:
remapsObjectId
in classSimpleField<ObjId>
-
remapObjectId
- Overrides:
remapObjectId
in classSimpleField<ObjId>
-