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.common.keymaster.client.api.model;
20  
21  import java.io.Serializable;
22  import org.apache.commons.lang3.builder.EqualsBuilder;
23  import org.apache.commons.lang3.builder.HashCodeBuilder;
24  
25  public class NetworkService implements Serializable {
26  
27      private static final long serialVersionUID = 7144725980960412224L;
28  
29      public enum Type {
30          CORE,
31          CONSOLE,
32          ENDUSER,
33          SRA,
34          WA
35  
36      }
37  
38      private Type type;
39  
40      private String address;
41  
42      public Type getType() {
43          return type;
44      }
45  
46      public void setType(final Type type) {
47          this.type = type;
48      }
49  
50      public String getAddress() {
51          return address;
52      }
53  
54      public void setAddress(final String address) {
55          this.address = address;
56      }
57  
58      @Override
59      public int hashCode() {
60          return new HashCodeBuilder().
61                  append(type).
62                  append(address).
63                  build();
64      }
65  
66      @Override
67      public boolean equals(final Object obj) {
68          if (this == obj) {
69              return true;
70          }
71          if (obj == null) {
72              return false;
73          }
74          if (getClass() != obj.getClass()) {
75              return false;
76          }
77          final NetworkService other = (NetworkService) obj;
78          return new EqualsBuilder().
79                  append(type, other.type).
80                  append(address, other.address).
81                  build();
82      }
83  
84      @Override
85      public String toString() {
86          return "NetworkService{"
87                  + "type=" + type
88                  + ", address=" + address
89                  + '}';
90      }
91  }