private boolean isRequired(RequestParam annotation) { System.out.println("required: " + annotation.value()); String defaultValue = annotation.defaultValue(); boolean missingDefaultValue = ValueConstants.DEFAULT_NONE.equals(defaultValue) || isNullOrEmpty(defaultValue); return annotation.required() && missingDefaultValue; }
/** * Determines default value of request param or request header, if available. * * @return value or null */ public String getDefaultValue() { String ret; if (isRequestParam()) { ret = isDefined(requestParam.defaultValue()) ? requestParam.defaultValue() : null; } else if (isRequestHeader()) { ret = !(ValueConstants.DEFAULT_NONE.equals(requestHeader.defaultValue())) ? requestHeader.defaultValue() : null; } else { ret = null; } return ret; }
protected String parseDefaultValueAttribute(String value) { return (ValueConstants.DEFAULT_NONE.equals(value) ? null : value); }
public static boolean isSet(String value) { return value != null && !value.trim().isEmpty() && !ValueConstants.DEFAULT_NONE.equals(value); }
private boolean isDefined(String defaultValue) { return !ValueConstants.DEFAULT_NONE.equals(defaultValue); }