Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-7472

Inconsistent annotation and getter/setter method for Service data model

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • yarn-native-services
    • None

    Description

      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.

        /**
         * 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();
        }
      

      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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              eyang Eric Yang
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: