Package io.permazen
Class PermazenSimpleField
java.lang.Object
io.permazen.PermazenSchemaItem
io.permazen.PermazenField
io.permazen.PermazenSimpleField
- Direct Known Subclasses:
PermazenEnumArrayField
,PermazenEnumField
,PermazenReferenceField
Represents a simple field in a
PermazenClass
or a simple sub-field of a complex field in a PermazenClass
.-
Method Summary
Modifier and TypeMethodDescriptionConverter<?,
?> 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.Encoding<?>
Get theEncoding
used by the core API to encode this field's values.Get the "full name" of this field.Index1<?,
?> View the index on this field.Get thePermazenComplexField
of which this instance is a sub-field, if any.SimpleField<?>
Get the corresonding core API database instance.Get the setter method associated with this field.TypeToken<?>
Get the type of this field.getValue
(PermazenObject pobj) Get the Java value of this field in the given Java model object.boolean
Get whether this field is indexed.boolean
Determine whether this field is a sub-field of aPermazenComplexField
.void
setValue
(PermazenObject pobj, Object value) Set the Java value of this field in the given object.<R> R
visit
(PermazenFieldSwitch<R> target) Apply visitor pattern.Methods inherited from class io.permazen.PermazenField
getGetter, getKey, getPermazenClass
Methods inherited from class io.permazen.PermazenSchemaItem
getName, getSchemaId, getStorageId, toString
-
Method Details
-
getDeclaringAnnotation
Description copied from class:PermazenField
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.- Overrides:
getDeclaringAnnotation
in classPermazenField
- Returns:
- declaring annotation
-
getFullName
Description copied from class:PermazenField
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.- Overrides:
getFullName
in classPermazenField
- Returns:
- parent
PermazenComplexField
, or null if this instance is not a sub-field
-
isSubField
public boolean isSubField()Determine whether this field is a sub-field of aPermazenComplexField
.- Returns:
- true if this field is a sub-field, otherwise false
-
getParentField
Get thePermazenComplexField
of which this instance is a sub-field, if any.- Returns:
- parent
PermazenComplexField
, or null if this instance is not a sub-field
-
getTypeToken
Get the type of this field.- Specified by:
getTypeToken
in classPermazenField
- Returns:
- this field's Java type
-
getEncoding
Get theEncoding
used by the core API to encode this field's values.Note that for
Enum
and reference fields, the core API uses a different type than the Java model classes (EnumValue
andObjId
, respectively). Values can always be properly converted using theConverter
returned bygetConverter()
.- Returns:
- this field's core-layer type definition
-
isIndexed
public boolean isIndexed()Get whether this field is indexed.- Returns:
- whether this field is indexed
-
getIndex
View the index on this field.- Parameters:
ptx
- transaction- Returns:
- view of the index on this field in
tx
- Throws:
StaleTransactionException
- iftx
is no longer usableIllegalArgumentException
- if this field is not indexedIllegalArgumentException
- iftx
is null
-
getSetter
Get the setter method associated with this field.- Returns:
- field property setter method, or null if this field is a sub-field of a complex field
-
getValue
Description copied from class:PermazenField
Get the Java value of this field in the given Java model object. Does not alter the schema of the object.- Specified by:
getValue
in classPermazenField
- Parameters:
pobj
- object containing this field- Returns:
- this field's value in
pobj
-
visit
Description copied from class:PermazenField
Apply visitor pattern.- Specified by:
visit
in classPermazenField
- Type Parameters:
R
- visit return type- Parameters:
target
- target to invoke- Returns:
- value from the method of
target
corresponding to this instance's type
-
getConverter
Description copied from class:PermazenField
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.- Specified by:
getConverter
in classPermazenField
- Parameters:
ptx
- transaction- Returns:
Converter
from core API to Java, or null if no conversion is required
-
setValue
Set the Java value of this field in the given object. Does not alter the schema of the object.- Parameters:
pobj
- object containing this fieldvalue
- new value- Throws:
DeletedObjectException
- ifpobj
does not exist in its associatedPermazenTransaction
StaleTransactionException
- if thePermazenTransaction
associated withpobj
is no longer usableIllegalArgumentException
- if this field is a sub-field of a complex fieldIllegalArgumentException
- ifvalue
is not an appropriate value for this fieldIllegalArgumentException
- ifpobj
is null
-
getSchemaItem
Description copied from class:PermazenSchemaItem
Get the corresonding core API database instance.- Overrides:
getSchemaItem
in classPermazenField
- Returns:
- this instance's correpsonding
SchemaItem
-