本文整理匯總了Java中org.oscm.validator.ADMValidator.isBoolean方法的典型用法代碼示例。如果您正苦於以下問題:Java ADMValidator.isBoolean方法的具體用法?Java ADMValidator.isBoolean怎麽用?Java ADMValidator.isBoolean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.oscm.validator.ADMValidator
的用法示例。
在下文中一共展示了ADMValidator.isBoolean方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: validate
import org.oscm.validator.ADMValidator; //導入方法依賴的package包/類
@Override
public void validate(Object obj) throws ValidationException {
super.validate(obj);
VOParameter parameter = (VOParameter) obj;
if(isOptionalAndNullOrEmpty(parameter)) {
return;
}
if (!ADMValidator.isBoolean(parameter.getValue())) {
throw new ValidationException(
ValidationException.ReasonEnum.BOOLEAN, null,
new Object[] { parameter.getParameterDefinition()
.getParameterId() });
}
}
示例2: validateBoolean
import org.oscm.validator.ADMValidator; //導入方法依賴的package包/類
private static void validateBoolean(PlatformConfigurationKey key,
String value) {
if (!ADMValidator.isBoolean(value)) {
throw new RuntimeException("The value for" + key
+ " must be TRUE or FALSE.");
}
}
示例3: validateBoolean
import org.oscm.validator.ADMValidator; //導入方法依賴的package包/類
/**
* Validates a boolean value.
*
* @param context
* the JSF context.
* @param uiComponent
* the UI component bing validated.
* @param value
* the value to be validated.
*/
private void validateBoolean(FacesContext context, UIComponent uiComponent,
String value) {
if (!ADMValidator.isBoolean(value)) {
Object[] args = null;
String label = JSFUtils.getLabel(uiComponent);
if (label != null) {
args = new Object[] { label };
}
ValidationException e = new ValidationException(
ValidationException.ReasonEnum.BOOLEAN, label, null);
String message = JSFUtils.getText(e.getMessageKey(), args, context);
throw getException(message);
}
}
示例4: validateBoolean
import org.oscm.validator.ADMValidator; //導入方法依賴的package包/類
private static void validateBoolean(ConfigurationKey key, String value) {
if (!ADMValidator.isBoolean(value)) {
throw new RuntimeException("The value for " + key.getKeyName()
+ " must be TRUE or FALSE.");
}
}
示例5: parameterIsValid
import org.oscm.validator.ADMValidator; //導入方法依賴的package包/類
public static boolean parameterIsValid(VOParameterDefinition parDefinition,
String parValue, FacesContext context) {
if (parDefinition == null) {
return false;
}
ParameterValueType parValueType = parDefinition.getValueType();
if (parValueType == null) {
return false;
}
if (parValue == null
|| parValue.length() > ADMValidator.LENGTH_DESCRIPTION) {
return false;
} else if (parValue.length() == 0) {
if (parDefinition.isMandatory()) {
return false;
} else {
if (parValueType != ParameterValueType.ENUMERATION) {
return true;
} else {
// A configured ENUM parameter must always have a value,
// even if it's optional...
return false;
}
}
}
switch (parValueType) {
case BOOLEAN:
return ADMValidator.isBoolean(parValue);
case STRING:
return true;
case DURATION:
return (DurationValidation.getDurationInMs(context, parValue) != null);
case INTEGER:
return integerIsValid(parDefinition, parValue);
case LONG:
return longIsValid(parDefinition, parValue);
case ENUMERATION:
return enumIsValid(parDefinition, parValue);
default:
return false;
}
}