|
@@ -1,55 +1,55 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.bo.attributes; |
3 |
|
- |
|
4 |
|
- |
import java.util.*; |
5 |
|
- |
|
6 |
|
- |
public class MinDisplayDecimalPlaces implements PropertyOfAMD { |
7 |
|
- |
public static MinDisplayDecimalPlaces of( int pLength ) { |
8 |
|
- |
return pLength >= 1 ? getInstance( pLength ) : null; |
9 |
|
- |
} |
10 |
|
- |
|
11 |
|
- |
public static Integer get( AttributeMetaData pAMD ) { |
12 |
|
- |
PropertyOfAMD zProperty = pAMD.getProperties().get( MAP_KEY ); |
13 |
|
- |
if ( zProperty != null ) { |
14 |
|
- |
return ((MinDisplayDecimalPlaces) zProperty).mValue; |
15 |
|
- |
} |
16 |
|
- |
return null; |
17 |
|
- |
} |
18 |
|
- |
|
19 |
|
- |
private static synchronized MinDisplayDecimalPlaces getInstance( int pLength ) { |
20 |
|
- |
MinDisplayDecimalPlaces zInstance = sInstances.get( pLength ); |
21 |
|
- |
if ( zInstance == null ) { |
22 |
|
- |
sInstances.put( pLength, zInstance = new MinDisplayDecimalPlaces( pLength ) ); |
23 |
|
- |
} |
24 |
|
- |
return zInstance; |
25 |
|
- |
} |
26 |
|
- |
|
27 |
|
- |
private static HashMap<Integer, MinDisplayDecimalPlaces> sInstances = new HashMap<Integer, MinDisplayDecimalPlaces>(); |
28 |
|
- |
|
29 |
|
- |
private static final String MAP_KEY = "MinDisplayDecimalPlaces"; |
30 |
|
- |
|
31 |
|
- |
private MinDisplayDecimalPlaces( int pValue ) { |
32 |
|
- |
mValue = pValue; |
33 |
|
- |
} |
34 |
|
- |
|
35 |
|
- |
private int mValue; |
36 |
|
- |
|
37 |
|
- |
@Override |
38 |
|
- |
public String toString() { |
39 |
|
- |
return MAP_KEY + ".of( " + mValue + ")"; |
40 |
|
- |
} |
41 |
|
- |
|
42 |
|
- |
public String getMapKey() { |
43 |
|
- |
return MAP_KEY; |
44 |
|
- |
} |
45 |
|
- |
|
46 |
|
- |
@Override |
47 |
|
- |
public boolean equals( Object them ) { |
48 |
|
- |
return (this == them) || ((them != null) && (this.getClass() == them.getClass()) && (this.mValue == ((MinDisplayDecimalPlaces) them).mValue)); |
49 |
|
- |
} |
50 |
|
- |
|
51 |
|
- |
@Override |
52 |
|
- |
public int hashCode() { |
53 |
|
- |
return mValue; |
54 |
|
- |
} |
55 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.bo.attributes; |
|
3 |
+ |
|
|
4 |
+ |
import java.util.*; |
|
5 |
+ |
|
|
6 |
+ |
public class MinDisplayDecimalPlaces implements PropertyOfAMD { |
|
7 |
+ |
public static MinDisplayDecimalPlaces of( int pLength ) { |
|
8 |
+ |
return pLength >= 1 ? getInstance( pLength ) : null; |
|
9 |
+ |
} |
|
10 |
+ |
|
|
11 |
+ |
public static Integer get( AttributeMetaData pAMD ) { |
|
12 |
+ |
PropertyOfAMD zProperty = pAMD.getProperties().get( MAP_KEY ); |
|
13 |
+ |
if ( zProperty != null ) { |
|
14 |
+ |
return ((MinDisplayDecimalPlaces) zProperty).mValue; |
|
15 |
+ |
} |
|
16 |
+ |
return null; |
|
17 |
+ |
} |
|
18 |
+ |
|
|
19 |
+ |
private static synchronized MinDisplayDecimalPlaces getInstance( int pLength ) { |
|
20 |
+ |
MinDisplayDecimalPlaces zInstance = sInstances.get( pLength ); |
|
21 |
+ |
if ( zInstance == null ) { |
|
22 |
+ |
sInstances.put( pLength, zInstance = new MinDisplayDecimalPlaces( pLength ) ); |
|
23 |
+ |
} |
|
24 |
+ |
return zInstance; |
|
25 |
+ |
} |
|
26 |
+ |
|
|
27 |
+ |
private static HashMap<Integer, MinDisplayDecimalPlaces> sInstances = new HashMap<Integer, MinDisplayDecimalPlaces>(); |
|
28 |
+ |
|
|
29 |
+ |
private static final String MAP_KEY = "MinDisplayDecimalPlaces"; |
|
30 |
+ |
|
|
31 |
+ |
private MinDisplayDecimalPlaces( int pValue ) { |
|
32 |
+ |
mValue = pValue; |
|
33 |
+ |
} |
|
34 |
+ |
|
|
35 |
+ |
private int mValue; |
|
36 |
+ |
|
|
37 |
+ |
@Override |
|
38 |
+ |
public String toString() { |
|
39 |
+ |
return MAP_KEY + ".of( " + mValue + ")"; |
|
40 |
+ |
} |
|
41 |
+ |
|
|
42 |
+ |
public String getMapKey() { |
|
43 |
+ |
return MAP_KEY; |
|
44 |
+ |
} |
|
45 |
+ |
|
|
46 |
+ |
@Override |
|
47 |
+ |
public boolean equals( Object them ) { |
|
48 |
+ |
return (this == them) || ((them != null) && (this.getClass() == them.getClass()) && (this.mValue == ((MinDisplayDecimalPlaces) them).mValue)); |
|
49 |
+ |
} |
|
50 |
+ |
|
|
51 |
+ |
@Override |
|
52 |
+ |
public int hashCode() { |
|
53 |
+ |
return mValue; |
|
54 |
+ |
} |
|
55 |
+ |
} |