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 java.time.OffsetDateTime;
22  import org.apache.commons.lang3.builder.EqualsBuilder;
23  import org.apache.commons.lang3.builder.HashCodeBuilder;
24  import org.apache.commons.lang3.builder.ToStringBuilder;
25  import org.apache.syncope.common.lib.BaseBean;
26  
27  public class U2FDevice implements BaseBean {
28  
29      private static final long serialVersionUID = 1185073386484048953L;
30  
31      public static class Builder {
32  
33          private final U2FDevice instance = new U2FDevice();
34  
35          public U2FDevice.Builder issueDate(final OffsetDateTime issued) {
36              instance.setIssueDate(issued);
37              return this;
38          }
39  
40          public U2FDevice.Builder record(final String record) {
41              instance.setRecord(record);
42              return this;
43          }
44  
45          public U2FDevice.Builder id(final long id) {
46              instance.setId(id);
47              return this;
48          }
49  
50          public U2FDevice build() {
51              return instance;
52          }
53      }
54  
55      private long id;
56  
57      private String record;
58  
59      private OffsetDateTime issueDate;
60  
61      public String getRecord() {
62          return record;
63      }
64  
65      public void setRecord(final String record) {
66          this.record = record;
67      }
68  
69      public long getId() {
70          return id;
71      }
72  
73      public void setId(final long id) {
74          this.id = id;
75      }
76  
77      public OffsetDateTime getIssueDate() {
78          return issueDate;
79      }
80  
81      public void setIssueDate(final OffsetDateTime issueDate) {
82          this.issueDate = issueDate;
83      }
84  
85      @Override
86      public int hashCode() {
87          return new HashCodeBuilder()
88                  .append(record)
89                  .append(id)
90                  .append(issueDate)
91                  .toHashCode();
92      }
93  
94      @Override
95      public boolean equals(final Object obj) {
96          if (obj == null) {
97              return false;
98          }
99          if (obj == this) {
100             return true;
101         }
102         if (obj.getClass() != getClass()) {
103             return false;
104         }
105         U2FDevice other = (U2FDevice) obj;
106         return new EqualsBuilder()
107                 .append(this.record, other.record)
108                 .append(this.id, other.id)
109                 .append(this.issueDate, other.issueDate)
110                 .isEquals();
111     }
112 
113     @Override
114     public String toString() {
115         return new ToStringBuilder(this)
116                 .append("record", record)
117                 .append("id", id)
118                 .append("issueDate", issueDate)
119                 .toString();
120     }
121 }