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.XmlRootElement;
27  import javax.xml.bind.annotation.XmlValue;
28  
29  import org.apache.hadoop.hbase.classification.InterfaceAudience;
30  
31  /**
32   * Simple representation of the version of the storage cluster
33   * 
34   * <pre>
35   * &lt;complexType name="StorageClusterVersion"&gt;
36   *   &lt;attribute name="version" type="string"&gt;&lt;/attribute&gt;
37   * &lt;/complexType&gt;
38   * </pre>
39   */
40  @XmlRootElement(name="ClusterVersion")
41  @InterfaceAudience.Private
42  public class StorageClusterVersionModel implements Serializable {
43    private static final long serialVersionUID = 1L;
44  
45    private String version;
46  
47    /**
48     * @return the storage cluster version
49     */
50    @XmlValue
51    public String getVersion() {
52      return version;
53    }
54  
55    /**
56     * @param version the storage cluster version
57     */
58    public void setVersion(String version) {
59      this.version = version;
60    }
61  
62    /* (non-Javadoc)
63     * @see java.lang.Object#toString()
64     */
65    @JsonValue
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  }