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 MaxValueCountElem
32 {
33
34 private AttributeType attributeType;
35
36
37 private int maxCount;
38
39
40
41
42
43
44
45
46 public MaxValueCountElem( AttributeType attributeType, int maxCount )
47 {
48 this.attributeType = attributeType;
49 this.maxCount = maxCount;
50 }
51
52
53
54
55
56
57
58 public AttributeType getAttributeType()
59 {
60 return attributeType;
61 }
62
63
64
65
66
67
68
69 public int getMaxCount()
70 {
71 return maxCount;
72 }
73
74
75
76
77
78 @Override
79 public int hashCode()
80 {
81 int hash = 37;
82 hash = hash * 17 + maxCount;
83
84 if ( attributeType != null )
85 {
86 hash = hash * 17 + attributeType.hashCode();
87 }
88
89 return hash;
90 }
91
92
93
94
95
96 @Override
97 public boolean equals( Object o )
98 {
99 if ( this == o )
100 {
101 return true;
102 }
103
104 if ( o instanceof MaxValueCountElem )
105 {
106 MaxValueCountElem that = ( MaxValueCountElem ) o;
107
108 if ( maxCount == that.maxCount )
109 {
110 if ( attributeType == null )
111 {
112 return that.attributeType == null;
113 }
114 else
115 {
116 return attributeType.equals( that.attributeType );
117 }
118 }
119 }
120
121 return false;
122 }
123
124
125
126
127
128 @Override
129 public String toString()
130 {
131 StringBuilder sb = new StringBuilder();
132
133 sb.append( "{ type " );
134
135 if ( attributeType != null )
136 {
137 sb.append( attributeType.getName() );
138 }
139 else
140 {
141 sb.append( "null" );
142 }
143
144 sb.append( ", maxCount " ).append( maxCount );
145 sb.append( "}" );
146
147 return sb.toString();
148 }
149 }