Search code examples
javajavers

How to register an identity class providing a global id string function in javers?


I am using javers on third party classes. Therefore, I am unable to add fields, annotations, or methods to the classes. Is it possible to provide a function to define the creation of id string of the object. Something like

public <T> JaversBuilder registerEntityWithCustomToString(Class<T> entityClass, Function<T, String> toString)

Is this possible? Is this already possible in some other way? I am already aware of registerValueWithCustomToString method, But, in some cases I need to combine several fields to create an unique id.


Solution

  • I'm affraid that it isn't possible. We have the open issue for that, see https://github.com/javers/javers/issues/625