View Javadoc

1   /*
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *     http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  
20  package org.apache.hadoop.hbase.rest.model;
21  
22  import org.codehaus.jackson.annotate.JsonValue;
23  
24  import java.io.Serializable;
25  
26  import javax.xml.bind.annotation.XmlAttribute;
27  import javax.xml.bind.annotation.XmlRootElement;
28  import javax.xml.bind.annotation.XmlValue;
29  
30  import org.apache.hadoop.hbase.classification.InterfaceAudience;
31  
32  /**
33   * Simple representation of the version of the storage cluster
34   * 
35   * <pre>
36   * &lt;complexType name="StorageClusterVersion"&gt;
37   *   &lt;attribute name="version" type="string"&gt;&lt;/attribute&gt;
38   * &lt;/complexType&gt;
39   * </pre>
40   */
41  @XmlRootElement(name="ClusterVersion")
42  @InterfaceAudience.Private
43  public class StorageClusterVersionModel implements Serializable {
44    private static final long serialVersionUID = 1L;
45  
46    private String version;
47  
48    /**
49     * @return the storage cluster version
50     */
51    @XmlAttribute(name="Version")
52    public String getVersion() {
53      return version;
54    }
55  
56    /**
57     * @param version the storage cluster version
58     */
59    public void setVersion(String version) {
60      this.version = version;
61    }
62  
63    /* (non-Javadoc)
64     * @see java.lang.Object#toString()
65     */
66    @Override
67    public String toString() {
68      return version;
69    }
70  
71      //needed for jackson deserialization
72      private static StorageClusterVersionModel valueOf(String value) {
73        StorageClusterVersionModel versionModel
74            = new StorageClusterVersionModel();
75        versionModel.setVersion(value);
76        return versionModel;
77      }
78  }