Re: PropertyVisibility

Roman Grigoriadi
 

Hi Dirk,

Look like a bug in Yasson. Can you please submit it to https://github.com/eclipse/yasson/issues ?


Thank you,
Roman

On Sun, Oct 22, 2017 at 10:31 AM Mark Struberg via Groups.Io <struberg=yahoo.de@groups.io> wrote:
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.

LieGrue,
strub


> Am 19.10.2017 um 21:27 schrieb Dirk Weil <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.