@Retention(value=RUNTIME) @Target(value=TYPE) @Documented public @interface JSimpleClass
JSimpleDB object model types.
Typically such classes are declared abstract and contain abstract Java bean getter methods
with @JField, @JSetField, etc. annotations that
define the fields of the object type.
The following annotations are supported on the methods of a @JSimpleClass-annotated class:
@JField - defines a simple value or reference field
@JSetField - defines a NavigableSet field
@JListField - defines a List field
@JMapField - defines a NavigableMap field
@OnChange - annotates a method to be invoked when some field (possibly seen through
a path of references) changes
@OnCreate - annotates a method to be invoked just after object creation
@OnDelete - annotates a method to be invoked just prior to object deletion
@OnValidate - annotates a method to be invoked whenever the object is (re)validated
@OnVersionChange - annotates a method to be invoked when the object's schema version changes
The above annotations may be present on any overridden supertype method, including methods in superclasses and superinterfaces
(whether or not annotated with @JSimpleClass).
The subclass of the annotated class that is generated by JSimpleDB will implement
JObject, so the (abstract) annotated class may be declared that way.
The annotated class must have a zero-parameter constructor.
| Modifier and Type | Optional Element and Description |
|---|---|
boolean |
autogenAllowDeleted
Configure the default for the
@JField.allowDeleted() property
for auto-generated reference fields. |
boolean |
autogenAllowDeletedSnapshot
Configure the default for the
@JField.allowDeletedSnapshot() property
for auto-generated reference fields. |
boolean |
autogenFields
Whether to automatically generate database fields from un-annotated abstract Java bean methods.
|
boolean |
autogenNonAbstract
Whether to automatically generate database fields even from non-abstract Java bean methods.
|
JCompositeIndex[] |
compositeIndexes
Composite indexes (i.e., indexes on two or more fields) defined on this type.
|
String |
name
The name of this object type.
|
int |
storageId
Storage ID for this object type.
|
public abstract String name
If equal to the empty string (default value), the simple name of the annotated Java class is used.
public abstract int storageId
StorageIdGenerator will be consulted to auto-generate a value.StorageIdGenerator.generateClassStorageId()public abstract JCompositeIndex[] compositeIndexes
public abstract boolean autogenFields
If true, database fields will be auto-generated corresponding to all abstract bean property getter methods,
even if there is no @JField, @JSetField,
@JListField, or @JMapField annotation.
Note this includes superclass and interface methods. Methods must be either public or
protected. In the case of simple fields, there must also be a corresponding setter method.
Getter methods with return type assignable to Set, List, and Map
will cause the corresponding collection fields to be created; other getter/setter method pairs will cause
the corresponding simple fields to be generated. Auto-generation of storage ID's is performed by the
configured StorageIdGenerator.
A @JTransient annotation on the getter method, or any overridden superclass method,
disables this auto-generation for that particular method (this is only useful when applied to non-abstract
methods, and therefore when autogenNonAbstract() is true: if applied to any abstract methods,
the auto-generated database subclass wouldn't be instantiable at runtime).
autogenNonAbstract(),
JSimpleDBFactory.setStorageIdGenerator()public abstract boolean autogenNonAbstract
If autogenFields() is false, this property is ignored. Otherwise, database fields will be auto-generated
corresponding to all bean property getter methods, whether or not marked abstract, unless there is
a @JTransient annotation.
autogenFields() is trueautogenFields(),
JTransientpublic abstract boolean autogenAllowDeleted
@JField.allowDeleted() property
for auto-generated reference fields.
If autogenFields() is false, this property is ignored. Otherwise, if this property is true,
any auto-generated reference fields will allow assignment to deleted objects in normal transactions.
In other words, they will behave as if they had a @JField annotation with JField.allowDeleted()
set to true.
JField.allowDeleted()public abstract boolean autogenAllowDeletedSnapshot
@JField.allowDeletedSnapshot() property
for auto-generated reference fields.
If autogenFields() is false, this property is ignored. Otherwise, if this property is true,
any auto-generated reference fields will allow assignment to deleted objects in snapshot transactions.
In other words, they will behave as if they had a @JField annotation with
JField.allowDeletedSnapshot() set to true.
JField.allowDeletedSnapshot()Copyright © 2017. All rights reserved.