Constructor and Description |
---|
PermazenFactory() |
Modifier and Type | Method and Description |
---|---|
Permazen |
newPermazen()
Construct a
Permazen instance using this instance's configuration. |
PermazenFactory |
setDatabase(Database database)
Configure the underlying
Database for this instance. |
PermazenFactory |
setModelClasses(Class<?>... modelClasses)
Configure the Java model classes.
|
PermazenFactory |
setModelClasses(Iterable<? extends Class<?>> modelClasses)
Configure the Java model classes.
|
PermazenFactory |
setSchemaVersion(int schemaVersion)
Configure the schema version number associated with the configured Java model classes.
|
PermazenFactory |
setStorageIdGenerator(StorageIdGenerator storageIdGenerator)
Configure the
StorageIdGenerator for auto-generating storage ID's when not explicitly
specified in @PermazenType ,
@JField , etc., annotations. |
PermazenFactory |
setValidatorFactory(javax.validation.ValidatorFactory validatorFactory)
Configure a custom
ValidatorFactory used to create Validator s
for validation within transactions. |
public PermazenFactory setModelClasses(Iterable<? extends Class<?>> modelClasses)
Note: @PermazenType
-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 @PermazenType
annotationspublic PermazenFactory setModelClasses(Class<?>... modelClasses)
Equivalent to setModelClasses
(Arrays.asList(modelClasses))
.
modelClasses
- classes annotated with @PermazenType
annotationssetModelClasses(Iterable)
public PermazenFactory 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 PermazenFactory setSchemaVersion(int schemaVersion)
A value of zero means to use whatever is the highest version already recorded in the database.
A value of -1 means to auto-generate
a version number based on the compatibility hash
of the SchemaModel
generated from the configured model classes.
Default is -1.
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 PermazenFactory setStorageIdGenerator(StorageIdGenerator storageIdGenerator)
StorageIdGenerator
for auto-generating storage ID's when not explicitly
specified in @PermazenType
,
@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 PermazenFactory setValidatorFactory(javax.validation.ValidatorFactory validatorFactory)
ValidatorFactory
used to create Validator
s
for validation within transactions.
The default is to use the result from Validation.buildDefaultValidatorFactory()
.
validatorFactory
- factory for validatorsIllegalArgumentException
- if validatorFactory
is nullpublic Permazen newPermazen()
Permazen
instance using this instance's configuration.Permazen
databaseIllegalArgumentException
- if this instance has an incomplete or invalid configurationIllegalArgumentException
- if any Java model class has an invalid annotationCopyright © 2022. All rights reserved.