Subversion Repository Public Repository

litesoft

Diff Revisions 949 vs 950 for /trunk/GWT_Sandbox/FormEngine/src/com/temp/shared/validators/Only7BitAlphaNumericUnderScoreValueValidator.java

Diff revisions: vs.
  @@ -1,36 +1,36 @@
1 - package com.temp.shared.validators;
2 -
3 - import org.litesoft.core.util.externalization.*;
4 -
5 - import com.temp.shared.*;
6 - import com.temp.shared.utils.*;
7 -
8 - public class Only7BitAlphaNumericUnderScoreValueValidator implements ValueValidator {
9 - public static final String TEMPLATE_ID_CODE = "Only7BitAlphaNumericUnderScore";
10 - public static final String TEMPLATE_NAME_WHY = "why";
11 - public static final String SUBTEMPLATE_WHY_NOT_STRING = "NotString";
12 - public static final String SUBTEMPLATE_WHY_EMPTY_STRING = "EmptyString";
13 -
14 - public static final ValueValidator INSTANCE = new Only7BitAlphaNumericUnderScoreValueValidator();
15 -
16 - private Only7BitAlphaNumericUnderScoreValueValidator() {
17 - }
18 -
19 - @Override
20 - public E13nData checkValue( Object value ) {
21 - if ( !(value instanceof String) ) {
22 - return new E13nData( TEMPLATE_ID_CODE ).addSubstitutionNamedSubTemplateIdCode( TEMPLATE_NAME_WHY, SUBTEMPLATE_WHY_NOT_STRING );
23 - }
24 - String userData = value.toString().trim();
25 - if ( userData.length() == 0 ) {
26 - return new E13nData( TEMPLATE_ID_CODE ).addSubstitutionNamedSubTemplateIdCode( TEMPLATE_NAME_WHY, SUBTEMPLATE_WHY_EMPTY_STRING );
27 - }
28 - for ( int i = 0; i < userData.length(); i++ ) {
29 - char c = userData.charAt( i );
30 - if ( !CharacterUtils.isAlphaNumericUnderScore7BitAscii( c ) ) {
31 -
32 - }
33 - }
34 - return null; // OK!
35 - }
36 - }
1 + package com.temp.shared.validators;
2 +
3 + import org.litesoft.core.util.externalization.*;
4 +
5 + import com.temp.shared.*;
6 + import com.temp.shared.utils.*;
7 +
8 + public class Only7BitAlphaNumericUnderScoreValueValidator implements ValueValidator {
9 + public static final String TEMPLATE_ID_CODE = "Only7BitAlphaNumericUnderScore";
10 + public static final String TEMPLATE_NAME_WHY = "why";
11 + public static final String SUBTEMPLATE_WHY_NOT_STRING = "NotString";
12 + public static final String SUBTEMPLATE_WHY_EMPTY_STRING = "EmptyString";
13 +
14 + public static final ValueValidator INSTANCE = new Only7BitAlphaNumericUnderScoreValueValidator();
15 +
16 + private Only7BitAlphaNumericUnderScoreValueValidator() {
17 + }
18 +
19 + @Override
20 + public E13nData checkValue( Object value ) {
21 + if ( !(value instanceof String) ) {
22 + return new E13nData( TEMPLATE_ID_CODE ).addSubstitutionNamedSubTemplateIdCode( TEMPLATE_NAME_WHY, SUBTEMPLATE_WHY_NOT_STRING );
23 + }
24 + String userData = value.toString().trim();
25 + if ( userData.length() == 0 ) {
26 + return new E13nData( TEMPLATE_ID_CODE ).addSubstitutionNamedSubTemplateIdCode( TEMPLATE_NAME_WHY, SUBTEMPLATE_WHY_EMPTY_STRING );
27 + }
28 + for ( int i = 0; i < userData.length(); i++ ) {
29 + char c = userData.charAt( i );
30 + if ( !CharacterUtils.isAlphaNumericUnderScore7BitAscii( c ) ) {
31 +
32 + }
33 + }
34 + return null; // OK!
35 + }
36 + }