private boolean isValid(int type,String value){
  if (value == null) {
    return false;
  }
  if (ALLOWED_STRINGS[type] != null) {
    return verifyStringGroup(value,ALLOWED_STRINGS[type]);
  }
switch (type) {
case TYPE_NUMBER:
    return verify(value,DIGITS,null);
case TYPE_PIXELS_OR_PERCENTAGE:
  if (value.endsWith("%")) {
    value=value.substring(0,value.length() - 1);
  }
 else   if (value.endsWith("px")) {
    value=value.substring(0,value.length() - 2);
  }
return verify(value,DIGITS,null);
case TYPE_CHAR:
return verify(value,DIGITS | ABC,null,1,1);
case TYPE_COLOR:
if (value.length() == 0) {
return false;
}
if (value.charAt(0) != '#') {
return verifyStringGroup(value,COLOR_STRINGS);
}
 else {
return verify(value.substring(1),HEX,null,3,6);
}
default :
return true;
}
}

private boolean isValid ( int type , String value ) { if ( value == null ) { return false ; } if ( ALLOWED_STRINGS [ type ] != null ) { return verifyStringGroup ( value , ALLOWED_STRINGS [ type ] ) ; } switch ( type ) { case TYPE_NUMBER : return verify ( value , DIGITS , null ) ; case TYPE_PIXELS_OR_PERCENTAGE : if ( value . endsWith ( "%" ) ) { value = value . substring ( 0 , value . length ( ) - 1 ) ; } else if ( value . endsWith ( "px" ) ) { value = value . substring ( 0 , value . length ( ) - 2 ) ; } return verify ( value , DIGITS , null ) ; case TYPE_CHAR : return verify ( value , DIGITS | ABC , null , 1 , 1 ) ; case TYPE_COLOR : if ( value . length ( ) == 0 ) { return false ; } if ( value . charAt ( 0 ) != '#' ) { return verifyStringGroup ( value , COLOR_STRINGS ) ; } else { return verify ( value . substring ( 1 ) , HEX , null , 3 , 6 ) ; } default : return true ; } }
verifies that the specified value conforms with the attribute ' s type restrictions . this basically checks the attribute type and according to that checks the value .
