Package io.permazen
Class PermazenField
java.lang.Object
io.permazen.PermazenSchemaItem
io.permazen.PermazenField
- Direct Known Subclasses:
PermazenComplexField
,PermazenCounterField
,PermazenSimpleField
Represents a field in a Java model object.
-
Method Summary
Modifier and TypeMethodDescriptionabstract Converter<?,
?> Get aConverter
that converts this field's value from what the core database returns to what the Java application expects, or null if no conversion is needed.Get theAnnotation
that declared this field.Get the "full name" of this field.Get the getter method associated with this field.byte[]
getKey
(PermazenObject pobj) Get thebyte[]
key in the underlying key/value store corresponding to this field in the specified object.Get thePermazenClass
of which this field is a member.Field<?>
Get the corresonding core API database instance.abstract TypeToken<?>
Get the type of this field.abstract Object
getValue
(PermazenObject pobj) Get the Java value of this field in the given Java model object.abstract <R> R
visit
(PermazenFieldSwitch<R> target) Apply visitor pattern.Methods inherited from class io.permazen.PermazenSchemaItem
getName, getSchemaId, getStorageId, toString
-
Method Details
-
getFullName
Get the "full name" of this field.If this field is a sub-field of a complex field, the full name is the field's name qualified by the parent field name, e.g.,
"mymap.key"
. Otherwise, the full is is the same as the name.- Returns:
- parent
PermazenComplexField
, or null if this instance is not a sub-field
-
getGetter
Get the getter method associated with this field.- Returns:
- field property getter method, or null if this field is a sub-field of a complex field
-
getDeclaringAnnotation
Get theAnnotation
that declared this field.If this field was auto-generated from an abstract method with no annotation, a non-null
Annotation
is still returned; it will have all default values.- Returns:
- declaring annotation
-
getValue
Get the Java value of this field in the given Java model object. Does not alter the schema of the object.- Parameters:
pobj
- object containing this field- Returns:
- this field's value in
pobj
- Throws:
DeletedObjectException
- ifpobj
does not exist in its associatedPermazenTransaction
StaleTransactionException
- if thePermazenTransaction
associated withpobj
is no longer usableIllegalArgumentException
- ifpobj
is nullIllegalArgumentException
- if this field is a sub-field of a complex field
-
getKey
Get thebyte[]
key in the underlying key/value store corresponding to this field in the specified object.Notes:
- Complex fields utilize multiple keys; the return value is the common prefix of all such keys.
- The
KVDatabase
should not be modified directly, otherwise behavior is undefined
- Parameters:
pobj
- Java model object- Returns:
- the corresonding
KVDatabase
key or key prefix - Throws:
IllegalArgumentException
- ifpobj
is null or has the wrong object type
-
visit
Apply visitor pattern.- Type Parameters:
R
- visit return type- Parameters:
target
- target to invoke- Returns:
- value from the method of
target
corresponding to this instance's type - Throws:
IllegalArgumentException
- iftarget
is null
-
getConverter
Get aConverter
that converts this field's value from what the core database returns to what the Java application expects, or null if no conversion is needed.- Parameters:
ptx
- transaction- Returns:
Converter
from core API to Java, or null if no conversion is required
-
getTypeToken
Get the type of this field.- Returns:
- this field's type
-
getPermazenClass
Get thePermazenClass
of which this field is a member.- Returns:
- this field's containing object type
-
getSchemaItem
Description copied from class:PermazenSchemaItem
Get the corresonding core API database instance.- Overrides:
getSchemaItem
in classPermazenSchemaItem
- Returns:
- this instance's correpsonding
SchemaItem
-