You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yarn-dev@hadoop.apache.org by "Eric Yang (JIRA)" <ji...@apache.org> on 2017/11/10 20:04:00 UTC

[jira] [Created] (YARN-7472) Inconsistent annotation and getter/setter method for Service data model

Eric Yang created YARN-7472:
-------------------------------

             Summary: Inconsistent annotation and getter/setter method for Service data model
                 Key: YARN-7472
                 URL: https://issues.apache.org/jira/browse/YARN-7472
             Project: Hadoop YARN
          Issue Type: Bug
          Components: yarn-native-services
            Reporter: Eric Yang


There are some inconsistency in annotations and getter setter methods for {{org.apache.hadoop.yarn.service.api.records.\*}} entity beans.  

@XmlAccessorType is not defined.  It is unclear if the serialization should be based on PUBLIC_MEMBER, FIELD or PROPERTY.

{code}
  /**
   * The time when the service was created, e.g. 2016-03-16T01:01:49.000Z.
   **/
  public Service launchTime(Date launchTime) {
    this.launchTime = launchTime == null ? null : (Date) launchTime.clone();
    return this;
  }

  @ApiModelProperty(example = "null", value = "The time when the service was created, e.g. 2016-03-16T01:01:49.000Z.")
  @JsonProperty("launch_time")
  public Date getLaunchTime() {
    return launchTime == null ? null : (Date) launchTime.clone();
  }

  @XmlElement(name = "launch_time")
  public void setLaunchTime(Date launchTime) {
    this.launchTime = launchTime == null ? null : (Date) launchTime.clone();
  }
{code}

{{JsonProperty}} and {{XmlElement}} tags are put in separate places, it is difficult to track.  Jersey complains duplicated getLaunchTime and launchTime serialized to the same field.  It would be nice if we agree on accessor type = FIELD or PUBLIC_MEMBER, and we only need one place to define both {{JsonProperty}} and {{XmlElement}} name.  We should not have a public method without getter or setter method to avoid confusion to Jersey or Jackson.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: yarn-dev-help@hadoop.apache.org