Package io.permazen
Class PermazenConfig.Builder
java.lang.Object
io.permazen.PermazenConfig.Builder
- All Implemented Interfaces:
Cloneable
- Enclosing class:
- PermazenConfig
Builder for
PermazenConfig
s.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Create a newPermazenConfig
from this instance.clone()
Clone this instance.Configure the underlyingDatabase
.initializeOnCreation
(boolean initializeOnCreation) Configure whether thePermazen
instance shouldinitialize()
automatically on instantiation.modelClasses
(Class<?>... modelClasses) Configure the Java model classes from an array.modelClasses
(Iterable<Class<?>> modelClasses) Configure the Java model classes via iteration.validatorFactory
(jakarta.validation.ValidatorFactory validatorFactory) Configure a customValidatorFactory
used to createValidator
s for validation within transactions.
-
Method Details
-
database
Configure the underlyingDatabase
.By default an initially empty, in-memory
MemoryKVDatabase
is used.- Parameters:
database
- core API database to use- Returns:
- this instance
-
validatorFactory
public PermazenConfig.Builder validatorFactory(jakarta.validation.ValidatorFactory validatorFactory) Configure a customValidatorFactory
used to createValidator
s for validation within transactions.The default is to use the result from
Validation.buildDefaultValidatorFactory()
.- Parameters:
validatorFactory
- factory for validators, or null for the default- Returns:
- this instance
-
modelClasses
Configure the Java model classes via iteration.Note:
@PermazenType
-annotated super-types of any class inmodelClasses
will be included, even if the super-type is not explicitly specified inmodelClasses
.- Parameters:
modelClasses
- classes annotated with@PermazenType
annotations- Returns:
- this instance
- Throws:
IllegalArgumentException
- ifmodelClasses
is null or contains a null class
-
modelClasses
Configure the Java model classes from an array.Note:
@PermazenType
-annotated super-types of any class inmodelClasses
will be included, even if the super-type is not explicitly specified inmodelClasses
.- Parameters:
modelClasses
- classes annotated with@PermazenType
annotations- Returns:
- this instance
- Throws:
IllegalArgumentException
- ifmodelClasses
is null or contains a null class
-
initializeOnCreation
Configure whether thePermazen
instance shouldinitialize()
automatically on instantiation.The default is false.
- Parameters:
initializeOnCreation
- true to initialize on instantiation, false to defer initialization
-
build
Create a newPermazenConfig
from this instance.- Returns:
- new
PermazenConfig
- Throws:
IllegalArgumentException
- if a model class has invalid annotation(s)InvalidSchemaException
- if the schema derived from the model classes is invalid
-
clone
Clone this instance.
-