Class Persistence
java.lang.Object
one.microstream.persistence.types.Persistence
- Direct Known Subclasses:
BinaryPersistence
public class Persistence extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Persistence.IdType
-
Constructor Summary
Constructors Modifier Constructor Description protected
Persistence()
Dummy constructor to prevent instantiation of this static-only utility class. -
Method Summary
-
Constructor Details
-
Persistence
protected Persistence()Dummy constructor to prevent instantiation of this static-only utility class.- Throws:
UnsupportedOperationException
- when called
-
-
Method Details
-
engineName
-
objectIdLabel
-
objectIdShortLabel
-
objectIdType
Central architectural information method that always returnslong.class
.- Returns:
long.class
-
createDefaultTypeLookup
-
defaultStartTypeId
public static final long defaultStartTypeId() -
defaultStartConstantId
public static final long defaultStartConstantId() -
defaultStartObjectId
public static final long defaultStartObjectId() -
defaultBoundConstantId
public static final long defaultBoundConstantId() -
classTypeId
public static final long classTypeId() -
isNativeType
-
getNativeTypeId
-
registerJavaNatives
-
registerJavaBasicTypes
-
iterateJavaBasicTypes
-
registerJavaConstants
-
validateObjectId
-
validateTypeId
-
iterateReferences
public static final void iterateReferences(PersistenceFunction iterator, Object[] array, int offset, int length) -
iterateReferences
-
iterateReferencesIterable
public static final void iterateReferencesIterable(PersistenceFunction iterator, Iterable<?> elements) -
iterateReferencesMap
-
standardCharset
Reasons for choosing UTF8 as the standard charset: 1.) It is independent from endianess. 2.) It is massively smaller due to most content containing almost only single-byte ASCII characters 3.) It is overall more commonly and widespread used and compatible than any specific format.- Returns:
- the UTF8 charset
-
defaultFilenameTypeDictionary
-
unpersistableTypes
Types whose instances cannot be persisted. E.g.Unpersistable
,Thread
,ClassLoader
, etc. Note that theClass
instances representing these types are very well persistable and will get empty type descriptions to assign type ids to them. Only their instances cannot be persisted.- Returns:
- the types whose instances cannot be persisted
-
isPersistable
-
isUnpersistable
-
typeMismatchValidatorFailing
-
typeMismatchValidatorNoOp
-
defaultTypeEvaluatorPersistable
-
isPersistableField
-
defaultFieldEvaluatorPersistable
-
defaultFieldEvaluatorPersister
-
isPersisterField
-
isHandleableEnumField
-
defaultFieldEvaluatorEnum
-
isHandleableCollectionField
-
defaultFieldEvaluatorCollection
-
defaultReferenceFieldEagerEvaluator
-
resolveEnumeratedClassIdentifierSeparatedType
public static <T> Class<T> resolveEnumeratedClassIdentifierSeparatedType(String typeName, ClassLoader classLoader, String substituteClassIdentifierSeparator) -
resolveType
-
resolveType
public static <T> Class<T> resolveType(String typeName, ClassLoader classLoader, String substituteClassIdentifierSeparator) -
tryResolveType
-
deriveEnumRootIdentifier
-
collectEnumConstants
-
enumRootIdentifierStart
-
parseEnumRootIdentifierTypeId
-
isEnumRootIdentifier
-
isPotentialEnumRootIdentifier
-
defaultRootIdentifier
Deprecated. -
customRootIdentifier
Deprecated. -
rootIdentifier
-
RefactoringMapping
@Deprecated public static final PersistenceRefactoringMappingProvider RefactoringMapping(File refactoringsFile)Deprecated.replaced byRefactoringMapping(Path)
, will be removed in version 8- Parameters:
refactoringsFile
- the file to read from- Returns:
- a new mapping provider
-
RefactoringMapping
public static final PersistenceRefactoringMappingProvider RefactoringMapping(Path refactoringsFile) -
RefactoringMapping
public static final PersistenceRefactoringMappingProvider RefactoringMapping(String refactoringMappings) -
RefactoringMapping
public static final PersistenceRefactoringMappingProvider RefactoringMapping(String refactoringMappings, char valueSeparator) -
RefactoringMapping
public static final PersistenceRefactoringMappingProvider RefactoringMapping(String refactoringMappings, XCsvDataType dataType) -
RefactoringMapping
public static final PersistenceRefactoringMappingProvider RefactoringMapping(String refactoringMappings, XCsvConfiguration configuration) -
RefactoringMapping
public static final PersistenceRefactoringMappingProvider RefactoringMapping(XGettingSequence<KeyValue<String,String>> refactoringMappings) -
readRefactoringMappings
@Deprecated public static XGettingSequence<KeyValue<String,String>> readRefactoringMappings(File file)Deprecated.replaced byreadRefactoringMappings(Path)
, will be removed in version 8- Parameters:
file
- the file to read from- Returns:
- refactoring mappings from the file
-
readRefactoringMappings
-
readRefactoringMappings
-
readRefactoringMappings
-
readRefactoringMappings
public static XGettingSequence<KeyValue<String,String>> readRefactoringMappings(String string, char valueSeparator) -
readRefactoringMappings
public static XGettingSequence<KeyValue<String,String>> readRefactoringMappings(String string, XCsvDataType dataType) -
readRefactoringMappings
public static XGettingSequence<KeyValue<String,String>> readRefactoringMappings(String string, XCsvConfiguration configuration) -
parseRefactoringMappings
public static XGettingSequence<KeyValue<String,String>> parseRefactoringMappings(StringTable stringTable) -
substituteClassIdentifierSeparator
Persistence-specific separator between a class name and a proper identifier that replaces unreliable class names (like "$1", "$2" etc.) by a reliably identifying substitute name.- Returns:
- separator between a class name and a proper identifier
-
derivePersistentTypeName
-
derivePersistentTypeName
-
derivePersistentTypeNameEnum
-
searchProvidedTypeHandler
public static <D, T> PersistenceTypeHandler<D,T> searchProvidedTypeHandler(Class<D> dataType, Class<T> entityType, Predicate<? super Method> selector) throws ReflectiveOperationExceptionSearches the methods of the passed entityType for a static method with arbitrary name and visibility, no arguments andPersistenceTypeHandler
or a sub type of it as its return type.Which method to select is also determined by testing the returned
PersistenceTypeHandler
instance if it has the correctPersistenceTypeHandler.dataType()
for the used persistence context and the correctPersistenceTypeHandler.type()
for the given entity class.This mechanism is a convenience shortcut alternative to
PersistenceFoundation.registerCustomTypeHandler(PersistenceTypeHandler)
.- Type Parameters:
D
- the data typeT
- the entity type- Parameters:
dataType
- the class for the data typeentityType
- the class for the entity typeselector
- custom selector logic- Returns:
- the provided type handler if found
- Throws:
ReflectiveOperationException
- if a reflection error occurs
-