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 aConverterthat 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 theAnnotationthat declared this field.Encoding<?>Get theEncodingused 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 thePermazenComplexFieldof 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.booleanGet whether this field is indexed.booleanDetermine whether this field is a sub-field of aPermazenComplexField.voidsetValue(PermazenObject pobj, Object value) Set the Java value of this field in the given object.<R> Rvisit(PermazenFieldSwitch<R> target) Apply visitor pattern.Methods inherited from class io.permazen.PermazenField
getGetter, getKey, getPermazenClassMethods inherited from class io.permazen.PermazenSchemaItem
getName, getSchemaId, getStorageId, toString
-
Method Details
-
getDeclaringAnnotation
Description copied from class:PermazenFieldGet theAnnotationthat declared this field.If this field was auto-generated from an abstract method with no annotation, a non-null
Annotationis still returned; it will have all default values.- Overrides:
getDeclaringAnnotationin classPermazenField- Returns:
- declaring annotation
-
getFullName
Description copied from class:PermazenFieldGet 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:
getFullNamein 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 thePermazenComplexFieldof 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:
getTypeTokenin classPermazenField- Returns:
- this field's Java type
-
getEncoding
Get theEncodingused by the core API to encode this field's values.Note that for
Enumand reference fields, the core API uses a different type than the Java model classes (EnumValueandObjId, respectively). Values can always be properly converted using theConverterreturned 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- iftxis no longer usableIllegalArgumentException- if this field is not indexedIllegalArgumentException- iftxis 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:PermazenFieldGet the Java value of this field in the given Java model object. Does not alter the schema of the object.- Specified by:
getValuein classPermazenField- Parameters:
pobj- object containing this field- Returns:
- this field's value in
pobj
-
visit
Description copied from class:PermazenFieldApply visitor pattern.- Specified by:
visitin classPermazenField- Type Parameters:
R- visit return type- Parameters:
target- target to invoke- Returns:
- value from the method of
targetcorresponding to this instance's type
-
getConverter
Description copied from class:PermazenFieldGet aConverterthat 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:
getConverterin classPermazenField- Parameters:
ptx- transaction- Returns:
Converterfrom 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- ifpobjdoes not exist in its associatedPermazenTransactionStaleTransactionException- if thePermazenTransactionassociated withpobjis no longer usableIllegalArgumentException- if this field is a sub-field of a complex fieldIllegalArgumentException- ifvalueis not an appropriate value for this fieldIllegalArgumentException- ifpobjis null
-
getSchemaItem
Description copied from class:PermazenSchemaItemGet the corresonding core API database instance.- Overrides:
getSchemaItemin classPermazenField- Returns:
- this instance's correpsonding
SchemaItem
-