litesoft
Diff Revisions
947
vs
948
for /trunk/GWT_Sandbox/FormEngine/src/com/temp/shared/validators/MinMaxLengthValueValidator.java
|
@@ -4,30 +4,25 @@ |
4 |
4 |
|
|
5 |
5 |
|
import com.temp.shared.utils.*; |
6 |
6 |
|
|
7 |
|
- |
public class MinMaxLengthValueValidator extends MaxLengthValueValidator |
8 |
|
- |
{ |
|
7 |
+ |
public class MinMaxLengthValueValidator extends MaxLengthValueValidator { |
9 |
8 |
|
public static final String TEMPLATE_ID_CODE_TOO_SHORT = "TooShort"; |
10 |
9 |
|
public static final String USER_DATA_MIN_LENGTH = "minLength"; |
11 |
10 |
|
|
12 |
11 |
|
private final int minLength; |
13 |
12 |
|
|
14 |
|
- |
public MinMaxLengthValueValidator( int minLength, int maxLength ) |
15 |
|
- |
{ |
|
13 |
+ |
public MinMaxLengthValueValidator( int minLength, int maxLength ) { |
16 |
14 |
|
super( maxLength ); |
17 |
15 |
|
this.minLength = Validate.length( "minLength", minLength ); |
18 |
16 |
|
} |
19 |
17 |
|
|
20 |
18 |
|
@Override |
21 |
|
- |
public E13nData checkValue( Object value ) |
22 |
|
- |
{ |
|
19 |
+ |
public E13nData checkValue( Object value ) { |
23 |
20 |
|
return super.checkValue( (value instanceof String) ? value : "" ); |
24 |
21 |
|
} |
25 |
22 |
|
|
26 |
23 |
|
@Override |
27 |
|
- |
protected E13nData checkString( String userData ) |
28 |
|
- |
{ |
29 |
|
- |
if ( userData.length() < minLength ) |
30 |
|
- |
{ |
|
24 |
+ |
protected E13nData checkString( String userData ) { |
|
25 |
+ |
if ( userData.length() < minLength ) { |
31 |
26 |
|
return new E13nData( TEMPLATE_ID_CODE_TOO_SHORT )// |
32 |
27 |
|
.addSubstitutionNamedUserData( USER_DATA_MIN_LENGTH, Integer.toString( minLength ) ) // |
33 |
28 |
|
.addSubstitutionNamedUserData( USER_DATA_CURRENT_LENGTH, Integer.toString( userData.length() ) ); |