使用 Microstream 得到以下异常。由引用静态内部类的类引起。我该如何解决这个问题?
异常状态如下,但文档没有解释如何实现PersistenceTypeResolver
详细信息:合成类($1 等)不是可靠的持久性,因为源代码元素的简单重新排序会改变类的名称标识。对于必须依赖于通过标识名称解析类型的类型系统,这将默默地导致潜在的致命错误。如果处理合成类(例如匿名内部类)是绝对必要的,则可以使用自定义 one.microstream.persistence.types.PersistenceTypeResolver 来删除异常并承担正确处理合成类名称的全部责任。在一个.microstream.persistence.types.Persistence.derivePersistentTypeName(Persistence.java:1083)
public static final AbstractAccompanyingPassenger DUMMY = new AbstractAccompanyingPassenger(MetaDataAccompanyingType.DUMMY) {
@Override
public AbstractAccompanyingPassenger clone() {
return DUMMY;
}};
Caused by: one.microstream.persistence.exceptions.PersistenceExceptionTypeNotPersistable: Type not persistable: "class net.atpco.metadata.summary.accompanied.MetaDataAccompanying$1". Details: Synthetic classes ($1 etc.) are not reliably persistence since a simple reordering of source code elements would change the name identity of a class. For a type system that has to rely upon resolving types by their identifying name, this would silently cause a potentially fatal error. If handling synthetic classes (e.g. anonymous inner classes) is absolutely necessary, a custom one.microstream.persistence.types.PersistenceTypeResolver can be used to remove the exception and assume complete responsibility for correctly handling synthetic class names.
at one.microstream.persistence.types.Persistence.derivePersistentTypeName(Persistence.java:1083)
at one.microstream.persistence.types.PersistenceTypeResolver.deriveTypeName(PersistenceTypeResolver.java:17)
at one.microstream.persistence.types.PersistenceTypeHandlerCreator$Abstract.deriveTypeName(PersistenceTypeHandlerCreator.java:73)
at one.microstream.persistence.binary.types.BinaryTypeHandlerCreator$Default.internalCreateTypeHandlerGeneric(BinaryTypeHandlerCreator.java:238)
at one.microstream.persistence.types.PersistenceTypeHandlerCreator$Abstract.createTypeHandlerGeneric(PersistenceTypeHandlerCreator.java:168)
at one.microstream.persistence.types.PersistenceTypeHandlerEnsurer$Default.ensureTypeHandler(PersistenceTypeHandlerEnsurer.java:199)
at one.microstream.persistence.internal.PersistenceTypeHandlerProviderCreating.ensureTypeHandler(PersistenceTypeHandlerProviderCreating.java:170)
at one.microstream.persistence.internal.PersistenceTypeHandlerProviderCreating.provideTypeHandler(PersistenceTypeHandlerProviderCreating.java:78)
at one.microstream.persistence.types.PersistenceTypeHandlerManager$Default.internalEnsureTypeHandler(PersistenceTypeHandlerManager.java:587)
at one.microstream.persistence.types.PersistenceTypeHandlerManager$Default.ensureTypeHandler(PersistenceTypeHandlerManager.java:357)
at one.microstream.persistence.types.PersistenceTypeHandlerManager$Default.ensureTypeHandler(PersistenceTypeHandlerManager.java:333)
at one.microstream.persistence.binary.types.BinaryStorer$Default.registerGuaranteed(BinaryStorer.java:557)
at one.microstream.persistence.binary.types.BinaryStorer$Default.registerLazyOptional(BinaryStorer.java:572)
at one.microstream.persistence.types.PersistenceObjectManager$Default.ensureObjectId(PersistenceObjectManager.java:182)
at one.microstream.persistence.binary.types.BinaryStorer$Default.register(BinaryStorer.java:591)
at one.microstream.persistence.binary.types.BinaryStorer$Default.apply(BinaryStorer.java:298)
at one.microstream.persistence.binary.types.BinaryValueFunctions$9.storeValueFromMemory(BinaryValueFunctions.java:147)
at one.microstream.persistence.binary.types.Binary.storeFixedSize(Binary.java:1149)
at one.microstream.persistence.binary.internal.AbstractBinaryHandlerReflective.store(AbstractBinaryHandlerReflective.java:497)
at one.microstream.persistence.binary.internal.AbstractBinaryHandlerReflective.store(AbstractBinaryHandlerReflective.java:1)
at one.microstream.persistence.binary.types.BinaryStorer$Default.storeItem(BinaryStorer.java:414)
at one.microstream.persistence.binary.types.BinaryStorer$Default.storeGraph(BinaryStorer.java:403)
at one.microstream.persistence.binary.types.BinaryStorer$Default.store(BinaryStorer.java:421)
at one.microstream.persistence.types.PersistenceManager$Default.store(PersistenceManager.java:274)
at one.microstream.storage.types.StorageConnection.store(StorageConnection.java:306)
at one.microstream.cache.CacheStore$Default.write(CacheStore.java:112)