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.core.provisioning.api.cache;
20  
21  import org.apache.commons.lang3.builder.EqualsBuilder;
22  import org.apache.commons.lang3.builder.HashCodeBuilder;
23  
24  /**
25   * Cache entry key.
26   */
27  @SuppressWarnings("squid:S2065")
28  public class VirAttrCacheKey {
29  
30      /**
31       * Any type name.
32       */
33      private final transient String anyType;
34  
35      /**
36       * Any object key.
37       */
38      private final transient String any;
39  
40      /**
41       * Virtual attribute schema name.
42       */
43      private final transient String schema;
44  
45      public VirAttrCacheKey(final String anyType, final String any, final String schema) {
46          this.anyType = anyType;
47          this.any = any;
48          this.schema = schema;
49      }
50  
51      public String getAnyType() {
52          return anyType;
53      }
54  
55      public String getAny() {
56          return any;
57      }
58  
59      public String getSchema() {
60          return schema;
61      }
62  
63      @Override
64      public int hashCode() {
65          return new HashCodeBuilder().
66                  append(anyType).
67                  append(any).
68                  append(schema).
69                  build();
70      }
71  
72      @Override
73      public boolean equals(final Object obj) {
74          if (this == obj) {
75              return true;
76          }
77          if (obj == null) {
78              return false;
79          }
80          if (getClass() != obj.getClass()) {
81              return false;
82          }
83          final VirAttrCacheKey other = (VirAttrCacheKey) obj;
84          return new EqualsBuilder().
85                  append(anyType, other.anyType).
86                  append(any, other.any).
87                  append(schema, other.schema).
88                  build();
89      }
90  
91      @Override
92      public String toString() {
93          return "VirAttrCacheKey{" + "anyType=" + anyType + ", any=" + any + ", schema=" + schema + '}';
94      }
95  }