[ all classes ]
[ com.acciente.oacc ]
Coverage Summary for Class: ResourceClassInfo (com.acciente.oacc)
Class | Class, % | Method, % | Line, % |
---|---|---|---|
ResourceClassInfo | 100% (1/ 1) | 66.7% (4/ 6) | 33.3% (8/ 24) |
1 /*
2 * Copyright 2009-2018, Acciente LLC
3 *
4 * Acciente LLC licenses this file to you under the
5 * Apache License, Version 2.0 (the "License"); you
6 * may not use this file except in compliance with the
7 * License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in
12 * writing, software distributed under the License is
13 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
14 * OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing
16 * permissions and limitations under the License.
17 */
18 package com.acciente.oacc;
19
20 import java.io.Serializable;
21
22 public class ResourceClassInfo implements Serializable {
23 private static final long serialVersionUID = 1L;
24
25 private final String resourceClassName;
26 private final boolean authenticatable;
27 private final boolean unauthenticatedCreateAllowed;
28
29 public ResourceClassInfo(String resourceClassName,
30 boolean authenticatable,
31 boolean unauthenticatedCreateAllowed) {
32 this.resourceClassName = resourceClassName;
33 this.authenticatable = authenticatable;
34 this.unauthenticatedCreateAllowed = unauthenticatedCreateAllowed;
35 }
36
37 public String getResourceClassName() {
38 return resourceClassName;
39 }
40
41 public boolean isAuthenticatable() {
42 return authenticatable;
43 }
44
45 public boolean isUnauthenticatedCreateAllowed() {
46 return unauthenticatedCreateAllowed;
47 }
48
49 @Override
50 public boolean equals(Object other) {
51 if (this == other) {
52 return true;
53 }
54 if (other == null || getClass() != other.getClass()) {
55 return false;
56 }
57
58 ResourceClassInfo otherResourceClassInfo = (ResourceClassInfo) other;
59
60 if (authenticatable != otherResourceClassInfo.authenticatable) {
61 return false;
62 }
63 if (unauthenticatedCreateAllowed != otherResourceClassInfo.unauthenticatedCreateAllowed) {
64 return false;
65 }
66 if (!resourceClassName.equals(otherResourceClassInfo.resourceClassName)) {
67 return false;
68 }
69
70 return true;
71 }
72
73 @Override
74 public int hashCode() {
75 int result = resourceClassName.hashCode();
76 result = 31 * result + (authenticatable ? 1 : 0);
77 result = 31 * result + (unauthenticatedCreateAllowed ? 1 : 0);
78 return result;
79 }
80 }