| Constructor and Description |
|---|
JSimpleDBFactory() |
| Modifier and Type | Method and Description |
|---|---|
JSimpleDB |
newJSimpleDB()
Construct a
JSimpleDB instance using this instance's configuration. |
JSimpleDBFactory |
setDatabase(Database database)
Configure the underlying
Database for this instance. |
JSimpleDBFactory |
setModelClasses(Class<?>... modelClasses)
Configure the Java model classes.
|
JSimpleDBFactory |
setModelClasses(Iterable<? extends Class<?>> modelClasses)
Configure the Java model classes.
|
JSimpleDBFactory |
setSchemaVersion(int schemaVersion)
Configure the schema version number associated with the configured Java model classes.
|
JSimpleDBFactory |
setStorageIdGenerator(StorageIdGenerator storageIdGenerator)
Configure the
StorageIdGenerator for auto-generating storage ID's when not explicitly
specified in @JSimpleClass,
@JField, etc., annotations. |
JSimpleDBFactory |
setValidatorFactory(ValidatorFactory validatorFactory)
Configure a custom
ValidatorFactory used to create Validators
for validation within transactions. |
public JSimpleDBFactory setModelClasses(Iterable<? extends Class<?>> modelClasses)
Note: @JSimpleClass-annotated super-types of any
class in modelClasses will be included, even if the super-type is not explicitly specified in modelClasses.
modelClasses - classes annotated with @JSimpleClass annotationspublic JSimpleDBFactory setModelClasses(Class<?>... modelClasses)
Equivalent to setModelClasses(Arrays.asList(modelClasses)).
modelClasses - classes annotated with @JSimpleClass annotationssetModelClasses(Iterable)public JSimpleDBFactory setDatabase(Database database)
Database for this instance.
By default this instance will use an initially empty, in-memory SimpleKVDatabase.
database - core API database to usepublic JSimpleDBFactory setSchemaVersion(int schemaVersion)
A value of zero means to use whatever is the highest version already recorded in the database.
However, if this instance has no Database configured, then an empty
SimpleKVDatabase is used and therefore a schema version of 1 is assumed.
A value of -1 means to auto-generate
a random version number based on the compatibility hash
of the SchemaModel generated from the configured model classes.
schemaVersion - the schema version number of the schema derived from the configured Java model classes,
zero to use the highest version already recorded in the database,
or -1 to use an auto-generated schema versionpublic JSimpleDBFactory setStorageIdGenerator(StorageIdGenerator storageIdGenerator)
StorageIdGenerator for auto-generating storage ID's when not explicitly
specified in @JSimpleClass,
@JField, etc., annotations.
This instance will initially be configured with a DefaultStorageIdGenerator.
To disable auto-generation of storage ID's altogether, configure a null value here.
storageIdGenerator - storage ID generator, or null to disable auto-generation of storage ID'spublic JSimpleDBFactory setValidatorFactory(ValidatorFactory validatorFactory)
ValidatorFactory used to create Validators
for validation within transactions.validatorFactory - factory for validatorsIllegalArgumentException - if validatorFactory is nullpublic JSimpleDB newJSimpleDB()
JSimpleDB instance using this instance's configuration.JSimpleDB databaseIllegalArgumentException - if this instance has an incomplete or invalid configurationIllegalArgumentException - if any Java model class has an invalid annotationCopyright © 2017. All rights reserved.