本文整理汇总了Java中org.ofbiz.minilang.ValidationException类的典型用法代码示例。如果您正苦于以下问题:Java ValidationException类的具体用法?Java ValidationException怎么用?Java ValidationException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ValidationException类属于org.ofbiz.minilang包,在下文中一共展示了ValidationException类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ResultToField
import org.ofbiz.minilang.ValidationException; //导入依赖的package包/类
private ResultToField(Element element, SimpleMethod simpleMethod) throws ValidationException {
if (MiniLangValidate.validationOn()) {
MiniLangValidate.attributeNames(simpleMethod, element, "result-name", "field");
MiniLangValidate.requiredAttributes(simpleMethod, element, "result-name");
MiniLangValidate.expressionAttributes(simpleMethod, element, "result-name", "field");
MiniLangValidate.noChildElements(simpleMethod, element);
}
this.resultNameFma = FlexibleMapAccessor.getInstance(element.getAttribute("result-name"));
String fieldAttribute = element.getAttribute("field");
if (fieldAttribute.length() == 0) {
this.fieldFma = this.resultNameFma;
} else {
this.fieldFma = FlexibleMapAccessor.getInstance(fieldAttribute);
}
}
示例2: Now
import org.ofbiz.minilang.ValidationException; //导入依赖的package包/类
public Now(Element element, SimpleMethod simpleMethod) throws MiniLangException {
super(element, simpleMethod);
if (MiniLangValidate.validationOn()) {
String tagName = element.getTagName();
if ("now-date-to-env".equals(tagName) || "now-timestamp".equals(tagName)) {
MiniLangValidate.handleError("Deprecated - use <now>", simpleMethod, element);
}
MiniLangValidate.attributeNames(simpleMethod, element, "field", "type");
MiniLangValidate.requiredAttributes(simpleMethod, element, "field");
MiniLangValidate.expressionAttributes(simpleMethod, element, "field");
MiniLangValidate.constantAttributes(simpleMethod, element, "type");
MiniLangValidate.noChildElements(simpleMethod, element);
}
boolean elementModified = autoCorrect(element);
if (elementModified && MiniLangUtil.autoCorrectOn()) {
MiniLangUtil.flagDocumentAsCorrected(element);
}
this.fieldFma = FlexibleMapAccessor.getInstance(element.getAttribute("field"));
this.type = element.getAttribute("type");
Class<?> targetClass = null;
try {
if (!this.type.isEmpty()) {
targetClass = ObjectType.loadClass(this.type);
}
if (targetClass == null) {
targetClass = java.sql.Timestamp.class;
}
this.converter = Converters.getConverter(Long.class, targetClass);
} catch (ClassNotFoundException e) {
throw new ValidationException(e.getMessage(), simpleMethod, element);
}
}