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