PropertyVisibility

Dirk Weil
 

Hi!

 

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

 

Assuming the following classes

 

@JsonbVisibility(AllFieldsVisibilityStrategy.class)

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

Dirk

 

Join jsonb-spec@javaee.groups.io to automatically receive all group messages.