ranger-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Madhan Neethiraj (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (RANGER-784) Annotate REST API classes to use get/set methods instead of directly accessing fields
Date Tue, 15 Dec 2015 22:25:46 GMT

     [ https://issues.apache.org/jira/browse/RANGER-784?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Madhan Neethiraj updated RANGER-784:
------------------------------------
    Attachment: 0001-RANGER-784-Annotate-REST-API-classes-to-use-get-set-.patch

> Annotate REST API classes to use get/set methods instead of directly accessing fields
> -------------------------------------------------------------------------------------
>
>                 Key: RANGER-784
>                 URL: https://issues.apache.org/jira/browse/RANGER-784
>             Project: Ranger
>          Issue Type: Bug
>          Components: admin
>    Affects Versions: 0.6.0
>            Reporter: Madhan Neethiraj
>            Assignee: Madhan Neethiraj
>             Fix For: 0.6.0
>
>         Attachments: 0001-RANGER-784-Annotate-REST-API-classes-to-use-get-set-.patch
>
>
> Classes used in REST API are currently annotated such that the JSON serialization/deserialization
directly access object fields to read/write. This can cause a field to be set to null while
deserializing if the incoming JSON does not include the field or if the value is explicitly
set to null.
> Set methods for collection-type fields in many REST API classes (like RangerPolicy/RangerService/RangerServiceDef)
sets the field to an empty collection object, when null value is given. This relieves all
the code that use these objects from having to check for null.
> Hence it is important for the deserialization to use set method, instead of directly
setting the fields. This can be done by replacing the annotation as given below:
> Replace the following:
>   @JsonAutoDetect(getterVisibility=Visibility.NONE, setterVisibility=Visibility.NONE,
fieldVisibility=Visibility.ANY)
> With:
>   @JsonAutoDetect(fieldVisibility=Visibility.ANY)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message