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 public MaxValueCountElem( AttributeType attributeType, int maxCount )
46 {
47 this.attributeType = attributeType;
48 this.maxCount = maxCount;
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 public int getMaxCount()
69 {
70 return maxCount;
71 }
72
73
74
75
76
77 @Override
78 public int hashCode()
79 {
80 int hash = 37;
81 hash = hash * 17 + maxCount;
82
83 if ( attributeType != null )
84 {
85 hash = hash * 17 + attributeType.hashCode();
86 }
87
88 return hash;
89 }
90
91
92
93
94
95 @Override
96 public boolean equals( Object o )
97 {
98 if ( this == o )
99 {
100 return true;
101 }
102
103 if ( o instanceof MaxValueCountElem )
104 {
105 MaxValueCountElem that = ( MaxValueCountElem ) o;
106
107 if ( maxCount == that.maxCount )
108 {
109 if ( attributeType == null )
110 {
111 return that.attributeType == null;
112 }
113 else
114 {
115 return attributeType.equals( that.attributeType );
116 }
117 }
118 }
119
120 return false;
121 }
122
123
124
125
126
127 @Override
128 public String toString()
129 {
130 StringBuilder sb = new StringBuilder();
131
132 sb.append( "{ type " );
133
134 if ( attributeType != null )
135 {
136 sb.append( attributeType.getName() );
137 }
138 else
139 {
140 sb.append( "null" );
141 }
142
143 sb.append( ", maxCount " ).append( maxCount );
144 sb.append( "}" );
145
146 return sb.toString();
147 }
148 }