litesoft
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
package org.litesoft.bo.attributes;
import org.litesoft.core.util.*;
import java.util.*;
public class Options implements PropertyOfAMD
{
public static Options of( String... pOptions )
{
return UtilsCommon.isNotNullOrEmpty( pOptions ) ? new Options( pOptions ) : null;
}
public static String[] get( AttributeMetaData pAMD )
{
PropertyOfAMD zProperty = pAMD.getProperties().get( MAP_KEY );
if ( zProperty != null )
{
return ((Options) zProperty).mValue;
}
return null;
}
public static Integer getLength( AttributeMetaData pAMD )
{
PropertyOfAMD zProperty = pAMD.getProperties().get( MAP_KEY );
if ( zProperty != null )
{
return ((Options) zProperty).getLength();
}
return null;
}
private static final String MAP_KEY = "Options";
private Integer mLength;
private Integer getLength()
{
if ( mLength == null )
{
int zMax = 2;
for ( String zEntry : mValue )
{
if ( zEntry != null )
{
zMax = Math.max( zMax, zEntry.length() );
}
}
mLength = zMax;
}
return mLength;
}
private Options( String[] pValue )
{
mValue = pValue;
}
private String[] mValue;
@Override
public String toString()
{
StringBuilder sb = new StringBuilder().append( MAP_KEY ).append( ".of( \"" ).append( mValue[0] ).append( '\"' );
for ( int i = 1; i < mValue.length; i++ )
{
sb.append( ", \"" ).append( mValue[i] ).append( '\"' );
}
return sb.append( " )" ).toString();
}
public String getMapKey()
{
return MAP_KEY;
}
@Override
public boolean equals( Object them )
{
return (this == them) || ((them != null) && (this.getClass() == them.getClass()) && Arrays.equals( this.mValue, ((Options) them).mValue ));
}
@Override
public int hashCode()
{
return mValue.length;
}
}
|
Revision |
Author |
Commited |
Message |
2
|
GeorgeS
|
Sun 07 Feb, 2010 12:50:58 +0000 |
|