1 19 20 package com.sslexplorer.input.validators; 21 22 import java.util.List ; 23 import java.util.Properties ; 24 25 import com.sslexplorer.boot.CodedException; 26 import com.sslexplorer.boot.PropertyDefinition; 27 import com.sslexplorer.boot.PropertyValidator; 28 import com.sslexplorer.core.CoreException; 29 30 31 36 public class BooleanValidator implements PropertyValidator { 37 38 public void validate(PropertyDefinition definition, String value, Properties properties) throws CodedException { 39 String trueVal = "true"; 40 String falseVal = "false"; 41 if (definition.getTypeMetaObject() != null && !definition.getTypeMetaObject().equals("")) { 42 trueVal = (String ) (((List ) definition.getTypeMetaObject()).get(0)); 43 falseVal = (String ) (((List ) definition.getTypeMetaObject()).get(1)); 44 } 45 if(!trueVal.equals(value) && !falseVal.equals(value)) { 46 47 throw new CoreException(ErrorConstants.ERR_INVALID_BOOLEAN, 48 ErrorConstants.CATEGORY_NAME, 49 ErrorConstants.BUNDLE_NAME, 50 null, 51 value, 52 trueVal, 53 falseVal, 54 null); 55 } 56 57 } 58 } 59 | Popular Tags |