当前位置: 首页>>代码示例>>Java>>正文


Java Conditional类代码示例

本文整理汇总了Java中org.ofbiz.minilang.method.conditional.Conditional的典型用法代码示例。如果您正苦于以下问题:Java Conditional类的具体用法?Java Conditional怎么用?Java Conditional使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Conditional类属于org.ofbiz.minilang.method.conditional包,在下文中一共展示了Conditional类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Assert

import org.ofbiz.minilang.method.conditional.Conditional; //导入依赖的package包/类
public Assert(Element element, SimpleMethod simpleMethod) throws MiniLangException {
    super(element, simpleMethod);
    if (MiniLangValidate.validationOn()) {
        MiniLangValidate.attributeNames(simpleMethod, element, "title", "error-list-name");
        MiniLangValidate.constantAttributes(simpleMethod, element, "title", "error-list-name");
    }
    errorListFma = FlexibleMapAccessor.getInstance(MiniLangValidate.checkAttribute(element.getAttribute("error-list-name"), "error_list"));
    titleExdr = FlexibleStringExpander.getInstance(element.getAttribute("title"));
    List<? extends Element> childElements = UtilXml.childElementList(element);
    if (MiniLangValidate.validationOn() && childElements.isEmpty()) {
        MiniLangValidate.handleError("No conditional elements.", simpleMethod, element);
    }
    List<Conditional> conditionalList = new ArrayList<Conditional>(childElements.size());
    for (Element conditionalElement : UtilXml.childElementList(element)) {
        conditionalList.add(ConditionalFactory.makeConditional(conditionalElement, simpleMethod));
    }
    this.conditionalList = Collections.unmodifiableList(conditionalList);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:19,代码来源:Assert.java

示例2: exec

import org.ofbiz.minilang.method.conditional.Conditional; //导入依赖的package包/类
@Override
public boolean exec(MethodContext methodContext) throws MiniLangException {
    if (methodContext.isTraceOn()) {
        outputTraceMessage(methodContext, "Begin assert.");
    }
    List<Object> messages = errorListFma.get(methodContext.getEnvMap());
    String title = titleExdr.expandString(methodContext.getEnvMap());
    for (Conditional condition : conditionalList) {
        if (!condition.checkCondition(methodContext)) {
            StringBuilder messageBuffer = new StringBuilder("Assertion ");
            if (!title.isEmpty()) {
                messageBuffer.append("[");
                messageBuffer.append(title);
                messageBuffer.append("] ");
            }
            messageBuffer.append("failed: ");
            condition.prettyPrint(messageBuffer, methodContext);
            if (messages == null) {
                messages = new LinkedList<Object>();
                errorListFma.put(methodContext.getEnvMap(), messages);
            }
            messages.add(messageBuffer.toString());
            if (methodContext.isTraceOn()) {
                outputTraceMessage(methodContext, "Condition evaluated to false: " + condition + ", adding error message.");
            }
        }
    }
    if (methodContext.isTraceOn()) {
        outputTraceMessage(methodContext, "End assert.");
    }
    return true;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:33,代码来源:Assert.java

示例3: toString

import org.ofbiz.minilang.method.conditional.Conditional; //导入依赖的package包/类
@Override
public String toString() {
    StringBuilder messageBuf = new StringBuilder("<assert");
    if (!titleExdr.isEmpty()) {
        messageBuf.append(" title=\"");
        messageBuf.append(titleExdr);
        messageBuf.append("\"");
    }
    messageBuf.append(">");
    for (Conditional condition : conditionalList) {
        messageBuf.append(condition);
    }
    messageBuf.append("</assert>");
    return messageBuf.toString();
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:16,代码来源:Assert.java


注:本文中的org.ofbiz.minilang.method.conditional.Conditional类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。