1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.api.ldap.aci.protectedItem;
21
22
23 import org.apache.directory.api.ldap.model.schema.AttributeType;
24
25
26
27
28
29
30
31 public class RestrictedByElem
32 {
33
34 private AttributeType attributeType;
35
36
37 private AttributeType valuesIn;
38
39
40
41
42
43
44
45 public RestrictedByElem( AttributeType attributeType, AttributeType valuesIn )
46 {
47 this.attributeType = attributeType;
48 this.valuesIn = valuesIn;
49 }
50
51
52
53
54
55
56
57 public AttributeType getAttributeType()
58 {
59 return attributeType;
60 }
61
62
63
64
65
66
67
68
69 public AttributeType getValuesIn()
70 {
71 return valuesIn;
72 }
73
74
75
76
77
78 @Override
79 public int hashCode()
80 {
81 int hash = 37;
82
83 if ( attributeType != null )
84 {
85 hash = hash * 17 + attributeType.hashCode();
86 }
87
88 if ( valuesIn != null )
89 {
90 hash = hash * 17 + valuesIn.hashCode();
91 }
92
93 return hash;
94 }
95
96
97
98
99
100 @Override
101 public boolean equals( Object o )
102 {
103 if ( this == o )
104 {
105 return true;
106 }
107
108 if ( o instanceof RestrictedByElem )
109 {
110 RestrictedByElem that = ( RestrictedByElem ) o;
111
112 if ( attributeType == null )
113 {
114 if ( that.attributeType == null )
115 {
116 if ( valuesIn == null )
117 {
118 return that.valuesIn == null;
119 }
120 else
121 {
122 return valuesIn.equals( that.valuesIn );
123 }
124 }
125 }
126 else
127 {
128 if ( attributeType.equals( that.attributeType ) )
129 {
130 if ( valuesIn == null )
131 {
132 return that.valuesIn == null;
133 }
134 else
135 {
136 return valuesIn.equals( that.valuesIn );
137 }
138 }
139 }
140 }
141
142 return false;
143 }
144
145
146
147
148
149 @Override
150 public String toString()
151 {
152 StringBuilder sb = new StringBuilder();
153
154 sb.append( "{ type " );
155
156 if ( attributeType != null )
157 {
158 sb.append( attributeType.getName() );
159 }
160 else
161 {
162 sb.append( "null" );
163 }
164
165 sb.append( ", valuesIn " );
166
167 if ( valuesIn != null )
168 {
169 sb.append( valuesIn.getName() );
170 }
171 else
172 {
173 sb.append( "null" );
174 }
175
176 sb.append( "}" );
177
178 return sb.toString();
179 }
180 }