|
Author: adrianc
Date: Sun Apr 29 08:11:53 2012 New Revision: 1331875 URL: http://svn.apache.org/viewvc?rev=1331875&view=rev Log: Refactored how Mini-language element model lists are constructed and stored - to improve thread-safety and memory use. Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ElseIf.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/MasterIf.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/While.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Iterate.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/IterateMap.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompare.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompareField.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfEmpty.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfHasPermission.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfInstanceOf.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfNotEmpty.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfRegexp.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfValidateMethod.java Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java?rev=1331875&r1=1331874&r2=1331875&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/SimpleMethod.java Sun Apr 29 08:11:53 2012 @@ -21,6 +21,7 @@ package org.ofbiz.minilang; import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; @@ -395,8 +396,9 @@ public class SimpleMethod { return simpleMethods; } - public static void readOperations(Element simpleMethodElement, List<MethodOperation> methodOperations, SimpleMethod simpleMethod) throws MiniLangException { + public static List<MethodOperation> readOperations(Element simpleMethodElement, SimpleMethod simpleMethod) throws MiniLangException { List<? extends Element> operationElements = UtilXml.childElementList(simpleMethodElement); + List<MethodOperation> methodOperations = new ArrayList<MethodOperation>(operationElements.size()); if (UtilValidate.isNotEmpty(operationElements)) { for (Element curOperElem : operationElements) { String nodeName = curOperElem.getNodeName(); @@ -407,16 +409,19 @@ public class SimpleMethod { } else if ("else".equals(nodeName)) { // don't add anything, but don't complain either, this one is handled in the individual operations } else { - Debug.logWarning("Operation element \"" + nodeName + "\" no recognized", module); + MiniLangValidate.handleError("Invalid element found", simpleMethod, curOperElem); } - if (methodOp == null) + if (methodOp == null) { continue; + } methodOperations.add(methodOp); DeprecatedOperation depOp = methodOp.getClass().getAnnotation(DeprecatedOperation.class); - if (depOp != null) - Debug.logInfo("The " + nodeName + " operation has been deprecated in favor of the " + depOp.value() + " operation; found use of this in [" + simpleMethod.getShortDescription() + "]: " + methodOp.rawString(), module); + if (depOp != null) { + MiniLangValidate.handleError("The " + nodeName + " operation has been deprecated in favor of the " + depOp.value() + " operation", simpleMethod, curOperElem); + } } } + return methodOperations; } public static String runSimpleEvent(String xmlResource, String methodName, HttpServletRequest request, HttpServletResponse response) throws MiniLangException { @@ -496,7 +501,7 @@ public class SimpleMethod { protected String localeName; protected boolean loginRequired = true; protected String methodName; - protected List<MethodOperation> methodOperations = FastList.newInstance(); + protected List<MethodOperation> methodOperations; protected String parameterMapName; protected Map<String, SimpleMethod> parentSimpleMethodsMap; protected String securityName; @@ -539,7 +544,7 @@ public class SimpleMethod { securityName = UtilXml.elementAttribute(simpleMethodElement, "security-name", "security"); dispatcherName = UtilXml.elementAttribute(simpleMethodElement, "dispatcher-name", "dispatcher"); userLoginName = UtilXml.elementAttribute(simpleMethodElement, "user-login-name", "userLogin"); - readOperations(simpleMethodElement, this.methodOperations, this); + this.methodOperations = Collections.unmodifiableList(readOperations(simpleMethodElement, this)); } /** Execute the Simple Method operations */ Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ElseIf.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ElseIf.java?rev=1331875&r1=1331874&r2=1331875&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ElseIf.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ElseIf.java Sun Apr 29 08:11:53 2012 @@ -18,10 +18,9 @@ *******************************************************************************/ package org.ofbiz.minilang.method.conditional; +import java.util.Collections; import java.util.List; -import javolution.util.FastList; - import org.ofbiz.base.util.UtilXml; import org.ofbiz.minilang.MiniLangException; import org.ofbiz.minilang.SimpleMethod; @@ -35,15 +34,14 @@ import org.w3c.dom.Element; public class ElseIf { protected Conditional condition; - protected List<MethodOperation> thenSubOps = FastList.newInstance(); + protected List<MethodOperation> thenSubOps; public ElseIf(Element element, SimpleMethod simpleMethod) throws MiniLangException { Element conditionElement = UtilXml.firstChildElement(element, "condition"); Element conditionChildElement = UtilXml.firstChildElement(conditionElement); this.condition = ConditionalFactory.makeConditional(conditionChildElement, simpleMethod); - Element thenElement = UtilXml.firstChildElement(element, "then"); - SimpleMethod.readOperations(thenElement, thenSubOps, simpleMethod); + this.thenSubOps = Collections.unmodifiableList(SimpleMethod.readOperations(thenElement, simpleMethod)); } public boolean checkCondition(MethodContext methodContext) { Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/MasterIf.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/MasterIf.java?rev=1331875&r1=1331874&r2=1331875&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/MasterIf.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/MasterIf.java Sun Apr 29 08:11:53 2012 @@ -18,6 +18,7 @@ *******************************************************************************/ package org.ofbiz.minilang.method.conditional; +import java.util.Collections; import java.util.List; import javolution.util.FastList; @@ -38,7 +39,7 @@ public class MasterIf extends MethodOper Conditional condition; List<ElseIf> elseIfs = null; List<MethodOperation> elseSubOps = null; - List<MethodOperation> thenSubOps = FastList.newInstance(); + List<MethodOperation> thenSubOps; public MasterIf(Element element, SimpleMethod simpleMethod) throws MiniLangException { super(element, simpleMethod); @@ -46,7 +47,7 @@ public class MasterIf extends MethodOper Element conditionChildElement = UtilXml.firstChildElement(conditionElement); this.condition = ConditionalFactory.makeConditional(conditionChildElement, simpleMethod); Element thenElement = UtilXml.firstChildElement(element, "then"); - SimpleMethod.readOperations(thenElement, thenSubOps, simpleMethod); + this.thenSubOps = Collections.unmodifiableList(SimpleMethod.readOperations(thenElement, simpleMethod)); List<? extends Element> elseIfElements = UtilXml.childElementList(element, "else-if"); if (UtilValidate.isNotEmpty(elseIfElements)) { elseIfs = FastList.newInstance(); @@ -56,8 +57,7 @@ public class MasterIf extends MethodOper } Element elseElement = UtilXml.firstChildElement(element, "else"); if (elseElement != null) { - elseSubOps = FastList.newInstance(); - SimpleMethod.readOperations(elseElement, elseSubOps, simpleMethod); + this.elseSubOps = Collections.unmodifiableList(SimpleMethod.readOperations(elseElement, simpleMethod)); } } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/While.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/While.java?rev=1331875&r1=1331874&r2=1331875&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/While.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/While.java Sun Apr 29 08:11:53 2012 @@ -18,10 +18,9 @@ *******************************************************************************/ package org.ofbiz.minilang.method.conditional; +import java.util.Collections; import java.util.List; -import javolution.util.FastList; - import org.ofbiz.base.util.UtilXml; import org.ofbiz.minilang.MiniLangException; import org.ofbiz.minilang.SimpleMethod; @@ -37,7 +36,7 @@ import org.w3c.dom.Element; public class While extends MethodOperation { Conditional condition; - List<MethodOperation> thenSubOps = FastList.newInstance(); + List<MethodOperation> thenSubOps; public While(Element element, SimpleMethod simpleMethod) throws MiniLangException { super(element, simpleMethod); @@ -45,7 +44,7 @@ public class While extends MethodOperati Element conditionChildElement = UtilXml.firstChildElement(conditionElement); this.condition = ConditionalFactory.makeConditional(conditionChildElement, simpleMethod); Element thenElement = UtilXml.firstChildElement(element, "then"); - SimpleMethod.readOperations(thenElement, thenSubOps, simpleMethod); + this.thenSubOps = Collections.unmodifiableList(SimpleMethod.readOperations(thenElement, simpleMethod)); } @Override Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Iterate.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Iterate.java?rev=1331875&r1=1331874&r2=1331875&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Iterate.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Iterate.java Sun Apr 29 08:11:53 2012 @@ -19,11 +19,10 @@ package org.ofbiz.minilang.method.envops; import java.util.Collection; +import java.util.Collections; import java.util.Iterator; import java.util.List; -import javolution.util.FastList; - import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.entity.GenericEntityException; @@ -47,13 +46,13 @@ public class Iterate extends MethodOpera protected ContextAccessor<Object> entryAcsr; protected ContextAccessor<Object> listAcsr; - protected List<MethodOperation> subOps = FastList.newInstance(); + protected List<MethodOperation> subOps; public Iterate(Element element, SimpleMethod simpleMethod) throws MiniLangException { super(element, simpleMethod); this.entryAcsr = new ContextAccessor<Object>(element.getAttribute("entry"), element.getAttribute("entry-name")); this.listAcsr = new ContextAccessor<Object>(element.getAttribute("list"), element.getAttribute("list-name")); - SimpleMethod.readOperations(element, subOps, simpleMethod); + this.subOps = Collections.unmodifiableList(SimpleMethod.readOperations(element, simpleMethod)); } @Override Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/IterateMap.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/IterateMap.java?rev=1331875&r1=1331874&r2=1331875&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/IterateMap.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/IterateMap.java Sun Apr 29 08:11:53 2012 @@ -18,11 +18,10 @@ *******************************************************************************/ package org.ofbiz.minilang.method.envops; +import java.util.Collections; import java.util.List; import java.util.Map; -import javolution.util.FastList; - import org.ofbiz.base.util.Debug; import org.ofbiz.minilang.MiniLangException; import org.ofbiz.minilang.SimpleMethod; @@ -42,7 +41,7 @@ public class IterateMap extends MethodOp ContextAccessor<Object> keyAcsr; ContextAccessor<Map<? extends Object, ? extends Object>> mapAcsr; - List<MethodOperation> subOps = FastList.newInstance(); + List<MethodOperation> subOps; ContextAccessor<Object> valueAcsr; public IterateMap(Element element, SimpleMethod simpleMethod) throws MiniLangException { @@ -50,7 +49,7 @@ public class IterateMap extends MethodOp this.keyAcsr = new ContextAccessor<Object>(element.getAttribute("key"), element.getAttribute("key-name")); this.valueAcsr = new ContextAccessor<Object>(element.getAttribute("value"), element.getAttribute("value-name")); this.mapAcsr = new ContextAccessor<Map<? extends Object, ? extends Object>>(element.getAttribute("map"), element.getAttribute("map-name")); - SimpleMethod.readOperations(element, subOps, simpleMethod); + this.subOps = Collections.unmodifiableList(SimpleMethod.readOperations(element, simpleMethod)); } @Override Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java?rev=1331875&r1=1331874&r2=1331875&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java Sun Apr 29 08:11:53 2012 @@ -18,10 +18,9 @@ *******************************************************************************/ package org.ofbiz.minilang.method.envops; +import java.util.Collections; import java.util.List; -import javolution.util.FastList; - import org.ofbiz.base.util.Debug; import org.ofbiz.minilang.MiniLangException; import org.ofbiz.minilang.SimpleMethod; @@ -41,13 +40,13 @@ public class Loop extends MethodOperatio protected String countStr; protected ContextAccessor<Integer> fieldAcsr; - protected List<MethodOperation> subOps = FastList.newInstance(); + protected List<MethodOperation> subOps; public Loop(Element element, SimpleMethod simpleMethod) throws MiniLangException { super(element, simpleMethod); this.fieldAcsr = new ContextAccessor<Integer>(element.getAttribute("field")); this.countStr = element.getAttribute("count"); - SimpleMethod.readOperations(element, subOps, simpleMethod); + this.subOps = Collections.unmodifiableList(SimpleMethod.readOperations(element, simpleMethod)); } @Override Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompare.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompare.java?rev=1331875&r1=1331874&r2=1331875&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompare.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompare.java Sun Apr 29 08:11:53 2012 @@ -18,6 +18,7 @@ *******************************************************************************/ package org.ofbiz.minilang.method.ifops; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -45,7 +46,7 @@ public class IfCompare extends MethodOpe protected String format; protected ContextAccessor<Map<String, ? extends Object>> mapAcsr; protected String operator; - protected List<MethodOperation> subOps = FastList.newInstance(); + protected List<MethodOperation> subOps; protected String type; protected String value; @@ -62,11 +63,10 @@ public class IfCompare extends MethodOpe this.operator = element.getAttribute("operator"); this.type = element.getAttribute("type"); this.format = element.getAttribute("format"); - SimpleMethod.readOperations(element, subOps, simpleMethod); + this.subOps = Collections.unmodifiableList(SimpleMethod.readOperations(element, simpleMethod)); Element elseElement = UtilXml.firstChildElement(element, "else"); if (elseElement != null) { - elseSubOps = FastList.newInstance(); - SimpleMethod.readOperations(elseElement, elseSubOps, simpleMethod); + this.elseSubOps = Collections.unmodifiableList(SimpleMethod.readOperations(elseElement, simpleMethod)); } } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompareField.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompareField.java?rev=1331875&r1=1331874&r2=1331875&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompareField.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompareField.java Sun Apr 29 08:11:53 2012 @@ -18,6 +18,7 @@ *******************************************************************************/ package org.ofbiz.minilang.method.ifops; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -45,7 +46,7 @@ public class IfCompareField extends Meth protected String format; protected ContextAccessor<Map<String, ? extends Object>> mapAcsr; protected String operator; - protected List<MethodOperation> subOps = FastList.newInstance(); + protected List<MethodOperation> subOps; protected ContextAccessor<Object> toFieldAcsr; protected ContextAccessor<Map<String, ? extends Object>> toMapAcsr; protected String type; @@ -73,11 +74,10 @@ public class IfCompareField extends Meth this.operator = element.getAttribute("operator"); this.type = element.getAttribute("type"); this.format = element.getAttribute("format"); - SimpleMethod.readOperations(element, subOps, simpleMethod); + this.subOps = Collections.unmodifiableList(SimpleMethod.readOperations(element, simpleMethod)); Element elseElement = UtilXml.firstChildElement(element, "else"); if (elseElement != null) { - elseSubOps = FastList.newInstance(); - SimpleMethod.readOperations(elseElement, elseSubOps, simpleMethod); + this.elseSubOps = Collections.unmodifiableList(SimpleMethod.readOperations(elseElement, simpleMethod)); } } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfEmpty.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfEmpty.java?rev=1331875&r1=1331874&r2=1331875&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfEmpty.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfEmpty.java Sun Apr 29 08:11:53 2012 @@ -18,6 +18,7 @@ *******************************************************************************/ package org.ofbiz.minilang.method.ifops; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -43,7 +44,7 @@ public class IfEmpty extends MethodOpera List<MethodOperation> elseSubOps = null; ContextAccessor<Object> fieldAcsr; ContextAccessor<Map<String, ? extends Object>> mapAcsr; - List<MethodOperation> subOps = FastList.newInstance(); + List<MethodOperation> subOps; public IfEmpty(Element element, SimpleMethod simpleMethod) throws MiniLangException { super(element, simpleMethod); @@ -54,11 +55,10 @@ public class IfEmpty extends MethodOpera // NOTE: this is still supported, but is deprecated this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name")); } - SimpleMethod.readOperations(element, subOps, simpleMethod); + this.subOps = Collections.unmodifiableList(SimpleMethod.readOperations(element, simpleMethod)); Element elseElement = UtilXml.firstChildElement(element, "else"); if (elseElement != null) { - elseSubOps = FastList.newInstance(); - SimpleMethod.readOperations(elseElement, elseSubOps, simpleMethod); + this.elseSubOps = Collections.unmodifiableList(SimpleMethod.readOperations(elseElement, simpleMethod)); } } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfHasPermission.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfHasPermission.java?rev=1331875&r1=1331874&r2=1331875&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfHasPermission.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfHasPermission.java Sun Apr 29 08:11:53 2012 @@ -18,6 +18,7 @@ *******************************************************************************/ package org.ofbiz.minilang.method.ifops; +import java.util.Collections; import java.util.List; import javolution.util.FastList; @@ -42,17 +43,16 @@ public class IfHasPermission extends Met protected FlexibleStringExpander actionExdr; protected List<MethodOperation> elseSubOps = null; protected FlexibleStringExpander permissionExdr; - protected List<MethodOperation> subOps = FastList.newInstance(); + protected List<MethodOperation> subOps; public IfHasPermission(Element element, SimpleMethod simpleMethod) throws MiniLangException { super(element, simpleMethod); this.permissionExdr = FlexibleStringExpander.getInstance(element.getAttribute("permission")); this.actionExdr = FlexibleStringExpander.getInstance(element.getAttribute("action")); - SimpleMethod.readOperations(element, subOps, simpleMethod); + this.subOps = Collections.unmodifiableList(SimpleMethod.readOperations(element, simpleMethod)); Element elseElement = UtilXml.firstChildElement(element, "else"); if (elseElement != null) { - elseSubOps = FastList.newInstance(); - SimpleMethod.readOperations(elseElement, elseSubOps, simpleMethod); + this.elseSubOps = Collections.unmodifiableList(SimpleMethod.readOperations(elseElement, simpleMethod)); } } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfInstanceOf.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfInstanceOf.java?rev=1331875&r1=1331874&r2=1331875&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfInstanceOf.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfInstanceOf.java Sun Apr 29 08:11:53 2012 @@ -18,6 +18,7 @@ *******************************************************************************/ package org.ofbiz.minilang.method.ifops; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -41,7 +42,7 @@ public class IfInstanceOf extends Method protected List<MethodOperation> elseSubOps = null; protected ContextAccessor<Object> fieldAcsr = null; protected ContextAccessor<Map<String, ? extends Object>> mapAcsr = null; - protected List<MethodOperation> subOps = FastList.newInstance(); + protected List<MethodOperation> subOps; public IfInstanceOf(Element element, SimpleMethod simpleMethod) throws MiniLangException { super(element, simpleMethod); @@ -49,11 +50,10 @@ public class IfInstanceOf extends Method this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field"), element.getAttribute("field-name")); this.mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name")); this.className = element.getAttribute("class"); - SimpleMethod.readOperations(element, subOps, simpleMethod); + this.subOps = Collections.unmodifiableList(SimpleMethod.readOperations(element, simpleMethod)); Element elseElement = UtilXml.firstChildElement(element, "else"); if (elseElement != null) { - elseSubOps = FastList.newInstance(); - SimpleMethod.readOperations(elseElement, elseSubOps, simpleMethod); + this.elseSubOps = Collections.unmodifiableList(SimpleMethod.readOperations(elseElement, simpleMethod)); } } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfNotEmpty.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfNotEmpty.java?rev=1331875&r1=1331874&r2=1331875&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfNotEmpty.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfNotEmpty.java Sun Apr 29 08:11:53 2012 @@ -18,6 +18,7 @@ *******************************************************************************/ package org.ofbiz.minilang.method.ifops; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -43,7 +44,7 @@ public class IfNotEmpty extends MethodOp protected List<MethodOperation> elseSubOps = null; protected ContextAccessor<Object> fieldAcsr; protected ContextAccessor<Map<String, ? extends Object>> mapAcsr; - protected List<MethodOperation> subOps = FastList.newInstance(); + protected List<MethodOperation> subOps; public IfNotEmpty(Element element, SimpleMethod simpleMethod) throws MiniLangException { super(element, simpleMethod); @@ -54,11 +55,10 @@ public class IfNotEmpty extends MethodOp // NOTE: this is still supported, but is deprecated this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name")); } - SimpleMethod.readOperations(element, subOps, simpleMethod); + this.subOps = Collections.unmodifiableList(SimpleMethod.readOperations(element, simpleMethod)); Element elseElement = UtilXml.firstChildElement(element, "else"); if (elseElement != null) { - elseSubOps = FastList.newInstance(); - SimpleMethod.readOperations(elseElement, elseSubOps, simpleMethod); + this.elseSubOps = Collections.unmodifiableList(SimpleMethod.readOperations(elseElement, simpleMethod)); } } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfRegexp.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfRegexp.java?rev=1331875&r1=1331874&r2=1331875&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfRegexp.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfRegexp.java Sun Apr 29 08:11:53 2012 @@ -18,6 +18,7 @@ *******************************************************************************/ package org.ofbiz.minilang.method.ifops; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -49,7 +50,7 @@ public class IfRegexp extends MethodOper FlexibleStringExpander exprExdr; ContextAccessor<Object> fieldAcsr; ContextAccessor<Map<String, ? extends Object>> mapAcsr; - List<MethodOperation> subOps = FastList.newInstance(); + List<MethodOperation> subOps; public IfRegexp(Element element, SimpleMethod simpleMethod) throws MiniLangException { super(element, simpleMethod); @@ -57,11 +58,10 @@ public class IfRegexp extends MethodOper this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field"), element.getAttribute("field-name")); this.mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name")); this.exprExdr = FlexibleStringExpander.getInstance(element.getAttribute("expr")); - SimpleMethod.readOperations(element, subOps, simpleMethod); + this.subOps = Collections.unmodifiableList(SimpleMethod.readOperations(element, simpleMethod)); Element elseElement = UtilXml.firstChildElement(element, "else"); if (elseElement != null) { - elseSubOps = FastList.newInstance(); - SimpleMethod.readOperations(elseElement, elseSubOps, simpleMethod); + this.elseSubOps = Collections.unmodifiableList(SimpleMethod.readOperations(elseElement, simpleMethod)); } } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfValidateMethod.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfValidateMethod.java?rev=1331875&r1=1331874&r2=1331875&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfValidateMethod.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfValidateMethod.java Sun Apr 29 08:11:53 2012 @@ -19,6 +19,7 @@ package org.ofbiz.minilang.method.ifops; import java.lang.reflect.Method; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -47,7 +48,7 @@ public class IfValidateMethod extends Me ContextAccessor<Object> fieldAcsr; ContextAccessor<Map<String, ? extends Object>> mapAcsr; String methodName; - List<MethodOperation> subOps = FastList.newInstance(); + List<MethodOperation> subOps; public IfValidateMethod(Element element, SimpleMethod simpleMethod) throws MiniLangException { super(element, simpleMethod); @@ -56,11 +57,10 @@ public class IfValidateMethod extends Me this.mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name")); this.methodName = element.getAttribute("method"); this.className = element.getAttribute("class"); - SimpleMethod.readOperations(element, subOps, simpleMethod); + this.subOps = Collections.unmodifiableList(SimpleMethod.readOperations(element, simpleMethod)); Element elseElement = UtilXml.firstChildElement(element, "else"); if (elseElement != null) { - elseSubOps = FastList.newInstance(); - SimpleMethod.readOperations(elseElement, elseSubOps, simpleMethod); + this.elseSubOps = Collections.unmodifiableList(SimpleMethod.readOperations(elseElement, simpleMethod)); } } |
| Free forum by Nabble | Edit this page |
