litesoft
Diff Revisions
947
vs
948
for /trunk/GWT_Sandbox/FormEngine/src/com/temp/shared/validators/IdentifierValueValidator.java
|
@@ -5,8 +5,7 @@ |
5 |
5 |
|
import com.temp.shared.*; |
6 |
6 |
|
import com.temp.shared.utils.*; |
7 |
7 |
|
|
8 |
|
- |
public class IdentifierValueValidator implements ValueValidator<String> |
9 |
|
- |
{ |
|
8 |
+ |
public class IdentifierValueValidator implements ValueValidator<String> { |
10 |
9 |
|
public static final String TEMPLATE_ID_CODE = "NotIdentifier"; |
11 |
10 |
|
public static final String TEMPLATE_NAME_WHY = "why"; |
12 |
11 |
|
public static final String SUBTEMPLATE_WHY_EMPTY_STRING = "EmptyString"; |
|
@@ -16,21 +15,17 @@ |
16 |
15 |
|
|
17 |
16 |
|
public static final ValueValidator<String> INSTANCE = new IdentifierValueValidator(); |
18 |
17 |
|
|
19 |
|
- |
private IdentifierValueValidator() |
20 |
|
- |
{ |
|
18 |
+ |
private IdentifierValueValidator() { |
21 |
19 |
|
} |
22 |
20 |
|
|
23 |
21 |
|
@Override |
24 |
|
- |
public E13nData checkValue( String value ) |
25 |
|
- |
{ |
|
22 |
+ |
public E13nData checkValue( String value ) { |
26 |
23 |
|
String userData = StringUtils.deNull( value ).trim(); |
27 |
|
- |
if ( userData.length() == 0 ) |
28 |
|
- |
{ |
|
24 |
+ |
if ( userData.length() == 0 ) { |
29 |
25 |
|
return new E13nData( TEMPLATE_ID_CODE ).addSubstitutionNamedSubTemplateIdCode( TEMPLATE_NAME_WHY, SUBTEMPLATE_WHY_EMPTY_STRING ); |
30 |
26 |
|
} |
31 |
27 |
|
int errorIndex = StringUtils.checkIdentifier( userData ); |
32 |
|
- |
if ( errorIndex == -1 ) |
33 |
|
- |
{ |
|
28 |
+ |
if ( errorIndex == -1 ) { |
34 |
29 |
|
return null; // OK! |
35 |
30 |
|
} |
36 |
31 |
|
return new E13nData( TEMPLATE_ID_CODE ).addSubstitutionNamedSubTemplateIdCode( TEMPLATE_NAME_WHY, SUBTEMPLATE_WHY_BAD_CHAR ) // |