1 7 package com.inversoft.util.typevalidator; 8 9 10 import java.util.Locale ; 11 12 import com.inversoft.util.StringTools; 13 14 15 21 public class RequiredTypeValidator extends BaseTypeValidator { 22 23 26 public static final String DEFAULT_MESSAGE = "Missing required value"; 27 28 29 39 protected String internalValidate(Object value, Object params, String message, 40 Locale locale, Object [] mesgParams) { 41 42 boolean valid = true; 43 if (value == null) { 44 valid = false; 45 } else { 46 String str = value.toString(); 47 valid = !StringTools.isEmpty(str); 48 } 49 50 String error = null; 51 if (!valid) { 52 error = getErrorMessage(message, DEFAULT_MESSAGE, mesgParams); 53 } 54 55 return error; 56 } 57 } 58 | Popular Tags |