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.lib.to;
20  
21  import org.apache.commons.lang3.builder.EqualsBuilder;
22  import org.apache.commons.lang3.builder.HashCodeBuilder;
23  import org.apache.commons.lang3.builder.ToStringBuilder;
24  
25  public class OIDCJWKSTO implements EntityTO {
26  
27      private static final long serialVersionUID = 1285073386484048953L;
28  
29      public static class Builder {
30  
31          private final OIDCJWKSTO instance = new OIDCJWKSTO();
32  
33          public OIDCJWKSTO.Builder json(final String json) {
34              instance.setJson(json);
35              return this;
36          }
37  
38          public OIDCJWKSTO.Builder key(final String key) {
39              instance.setKey(key);
40              return this;
41          }
42  
43          public OIDCJWKSTO build() {
44              return instance;
45          }
46      }
47  
48      private String key;
49  
50      private String json;
51  
52      public String getJson() {
53          return json;
54      }
55  
56      public void setJson(final String json) {
57          this.json = json;
58      }
59  
60      @Override
61      public String getKey() {
62          return key;
63      }
64  
65      @Override
66      public void setKey(final String key) {
67          this.key = key;
68      }
69  
70      @Override
71      public int hashCode() {
72          return new HashCodeBuilder()
73                  .appendSuper(super.hashCode())
74                  .append(key)
75                  .append(json)
76                  .toHashCode();
77      }
78  
79      @Override
80      public boolean equals(final Object obj) {
81          if (obj == null) {
82              return false;
83          }
84          if (obj == this) {
85              return true;
86          }
87          if (obj.getClass() != getClass()) {
88              return false;
89          }
90          OIDCJWKSTO rhs = (OIDCJWKSTO) obj;
91          return new EqualsBuilder()
92                  .appendSuper(super.equals(obj))
93                  .append(this.key, rhs.key)
94                  .append(this.json, rhs.json)
95                  .isEquals();
96      }
97  
98      @Override
99      public String toString() {
100         return new ToStringBuilder(this)
101                 .append("key", key)
102                 .append("json", json)
103                 .toString();
104     }
105 }