View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.syncope.client.ui.commons.markup.html.form;
20  
21  import java.io.Serializable;
22  import org.apache.commons.lang3.builder.HashCodeBuilder;
23  
24  public class SelectOption implements Serializable {
25  
26      private static final long serialVersionUID = 2961127533930849828L;
27  
28      private String displayValue;
29  
30      private String keyValue;
31  
32      public SelectOption(final String displayValue, final String keyValue) {
33          this.displayValue = displayValue;
34          this.keyValue = keyValue;
35      }
36  
37      public String getDisplayValue() {
38          return displayValue;
39      }
40  
41      public void setDisplayValue(final String displayValue) {
42          this.displayValue = displayValue;
43      }
44  
45      public String getKeyValue() {
46          return keyValue;
47      }
48  
49      public void setKeyValue(final String keyValue) {
50          this.keyValue = keyValue;
51      }
52  
53      @Override
54      public boolean equals(final Object obj) {
55          if (obj == null || !(obj instanceof SelectOption)) {
56              return false;
57          }
58  
59          return (keyValue == null && ((SelectOption) obj).keyValue == null) || keyValue != null
60                  && keyValue.equals(((SelectOption) obj).keyValue);
61      }
62  
63      @Override
64      public int hashCode() {
65          return HashCodeBuilder.reflectionHashCode(this);
66      }
67  
68      @Override
69      public String toString() {
70          return keyValue;
71      }
72  }