Re: PropertyVisibility

Mark Struberg

Hi Dirk!

From the JavaDoc of PropertyVisibilityStrategy:

* Responds whether the given field should be considered
* as the JsonbProperty.
* @param field member of the class
* @return true if member should be visible
boolean isVisible(Field field);

If your AllFieldsVisibilityStrategy returns true for all fields then those fields are all JsonbProperties.
And a JsonbProperty must get used for serialisation and deserialisation.


Am 19.10.2017 um 21:27 schrieb Dirk Weil <dirk.weil@...>:


May I ask for some clarification about 3.7.1 Scope and Field access strategy 4.6 Custom visibility?

Assuming the following classes

public class Country {

private String name;

public String getName() {
return name;

public class AllFieldsVisibilityStrategy implements PropertyVisibilityStrategy {
public boolean isVisible(Field field) {
return true;

public boolean isVisible(Method method) {
return false;

will the field name by serialized/deserialized to/from the json string?

The field is private and has just a public getter, so according to 3.7.1 it will be serialized, but it is unclear if it will be deserialized. The AllFieldsVisibilityStrategy overrules this decision. IMO the field should by serialized and deserialized. Apache Johnzon acts this way, but Eclipse Yasson ignores the field for deserialization.

What is the intended behavior?

Thanks and regards

Join to automatically receive all group messages.