jakartaee / jsonb-api

Jakarta JSON Binding
https://eclipse-ee4j.github.io/jsonb-api/
Other
79 stars 39 forks source link

visibility SPI does not enable to implement default rules #328

Open rmannibucau opened 2 years ago

rmannibucau commented 2 years ago

The default implicit visibility spi equivalent has rules like "if there is a field and some getter/setter ....", this can only be implemented if you have the field + the clazz being mapped (example ClassWithField and SubClassWithGetterForField). Current SPI does not enable to implement that. Idea of this ticket is to give a context enabling to implement such a rule passing the class being mapped too and if it is for serialization or deserialization (I guess we want a context {field,class,type}). Similarly for methods we would need a context too. Current methods can be implemented with a default in a ContextAwarePropertyVisibility new SPI to not break backward compatibility maybe?

rmannibucau commented 2 years ago

partially related to https://github.com/eclipse-ee4j/jsonb-api/issues/325 but also adds the (de)serialization info