You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2008/08/04 05:00:57 UTC
svn commit: r682246 [4/4] - in
/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang: ./ method/
method/callops/ method/conditional/ method/entityops/ method/envops/
method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/
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=682246&r1=682245&r2=682246&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 Aug 3 20:00:54 2008
@@ -39,10 +39,10 @@
protected List<MethodOperation> subOps = FastList.newInstance();
protected List<MethodOperation> elseSubOps = null;
- protected ContextAccessor mapAcsr;
- protected ContextAccessor fieldAcsr;
- protected ContextAccessor toMapAcsr;
- protected ContextAccessor toFieldAcsr;
+ protected ContextAccessor<Map<String, ? extends Object>> mapAcsr;
+ protected ContextAccessor<Object> fieldAcsr;
+ protected ContextAccessor<Map<String, ? extends Object>> toMapAcsr;
+ protected ContextAccessor<Object> toFieldAcsr;
protected String operator;
protected String type;
@@ -51,20 +51,20 @@
public IfCompareField(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
// NOTE: this is still supported, but is deprecated
- this.mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- this.fieldAcsr = new ContextAccessor(element.getAttribute("field"));
+ this.mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
+ this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field"));
if (this.fieldAcsr.isEmpty()) {
// NOTE: this is still supported, but is deprecated
- this.fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
}
// NOTE: this is still supported, but is deprecated
- this.toMapAcsr = new ContextAccessor(element.getAttribute("to-map-name"));
+ this.toMapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("to-map-name"));
// set fieldAcsr to their defualt value of fieldAcsr if empty
- this.toFieldAcsr = new ContextAccessor(element.getAttribute("to-field"), element.getAttribute("field"));
+ this.toFieldAcsr = new ContextAccessor<Object>(element.getAttribute("to-field"), element.getAttribute("field"));
if (this.toFieldAcsr.isEmpty()) {
// NOTE: this is still supported, but is deprecated
- this.toFieldAcsr = new ContextAccessor(element.getAttribute("to-field-name"), element.getAttribute("field-name"));
+ this.toFieldAcsr = new ContextAccessor<Object>(element.getAttribute("to-field-name"), element.getAttribute("field-name"));
}
// do NOT default the to-map-name to the map-name because that
@@ -95,7 +95,7 @@
Object fieldVal2 = null;
if (!mapAcsr.isEmpty()) {
- Map fromMap = (Map) mapAcsr.get(methodContext);
+ Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
if (fromMap == null) {
if (Debug.infoOn()) Debug.logInfo("Map not found with name " + mapAcsr + ", using null for comparison", module);
} else {
@@ -107,7 +107,7 @@
}
if (!toMapAcsr.isEmpty()) {
- Map toMap = (Map) toMapAcsr.get(methodContext);
+ Map<String, ? extends Object> toMap = toMapAcsr.get(methodContext);
if (toMap == null) {
if (Debug.infoOn()) Debug.logInfo("To Map not found with name " + toMapAcsr + ", using null for comparison", module);
} else {
@@ -118,17 +118,16 @@
fieldVal2 = toFieldAcsr.get(methodContext);
}
- List messages = FastList.newInstance();
+ List<Object> messages = FastList.newInstance();
Boolean resultBool = BaseCompare.doRealCompare(fieldVal1, fieldVal2, operator, type, format, messages, null, methodContext.getLoader(), false);
if (messages.size() > 0) {
messages.add(0, "Error with comparison in if-compare-field between fields [" + mapAcsr.toString() + "." + fieldAcsr.toString() + "] with value [" + fieldVal1 + "] and [" + toMapAcsr.toString() + "." + toFieldAcsr.toString() + "] with value [" + fieldVal2 + "] with operator [" + operator + "] and type [" + type + "]: ");
if (methodContext.getMethodType() == MethodContext.EVENT) {
- StringBuffer fullString = new StringBuffer();
+ StringBuilder fullString = new StringBuilder();
- Iterator miter = messages.iterator();
- while (miter.hasNext()) {
- fullString.append((String) miter.next());
+ for (Object message: messages) {
+ fullString.append(message);
}
Debug.logWarning(fullString.toString(), module);
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=682246&r1=682245&r2=682246&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 Aug 3 20:00:54 2008
@@ -37,17 +37,17 @@
List<MethodOperation> subOps = FastList.newInstance();
List<MethodOperation> elseSubOps = null;
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
+ ContextAccessor<Map<String, ? extends Object>> mapAcsr;
+ ContextAccessor<Object> fieldAcsr;
public IfEmpty(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
// NOTE: this is still supported, but is deprecated
- this.mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- this.fieldAcsr = new ContextAccessor(element.getAttribute("field"));
+ this.mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
+ this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field"));
if (this.fieldAcsr.isEmpty()) {
// NOTE: this is still supported, but is deprecated
- this.fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
}
SimpleMethod.readOperations(element, subOps, simpleMethod);
@@ -69,7 +69,7 @@
Object fieldVal = null;
if (!mapAcsr.isEmpty()) {
- Map fromMap = (Map) mapAcsr.get(methodContext);
+ Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
if (fromMap == null) {
if (Debug.infoOn()) Debug.logInfo("Map not found with name " + mapAcsr + ", running operations", module);
} else {
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=682246&r1=682245&r2=682246&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 Aug 3 20:00:54 2008
@@ -19,7 +19,6 @@
package org.ofbiz.minilang.method.ifops;
import java.util.List;
-import java.util.LinkedList;
import java.util.Map;
import javolution.util.FastList;
@@ -38,24 +37,24 @@
public static final String module = IfInstanceOf.class.getName();
- protected List subOps = new LinkedList();
- protected List elseSubOps = null;
+ protected List<MethodOperation> subOps = FastList.newInstance();
+ protected List<MethodOperation> elseSubOps = null;
- protected ContextAccessor mapAcsr = null;
- protected ContextAccessor fieldAcsr = null;
+ protected ContextAccessor<Map<String, ? extends Object>> mapAcsr = null;
+ protected ContextAccessor<Object> fieldAcsr = null;
protected String className = null;
public IfInstanceOf(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- this.mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- this.fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ this.mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
+ this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
this.className = element.getAttribute("class");
SimpleMethod.readOperations(element, subOps, simpleMethod);
Element elseElement = UtilXml.firstChildElement(element, "else");
if (elseElement != null) {
- elseSubOps = new LinkedList();
+ elseSubOps = FastList.newInstance();
SimpleMethod.readOperations(elseElement, elseSubOps, simpleMethod);
}
}
@@ -66,7 +65,7 @@
Object fieldVal = null;
if (!mapAcsr.isEmpty()) {
- Map fromMap = (Map) mapAcsr.get(methodContext);
+ Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
if (fromMap == null) {
if (Debug.infoOn()) Debug.logInfo("Map not found with name " + mapAcsr + ", running operations", module);
} else {
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=682246&r1=682245&r2=682246&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 Aug 3 20:00:54 2008
@@ -37,17 +37,17 @@
protected List<MethodOperation> subOps = FastList.newInstance();
protected List<MethodOperation> elseSubOps = null;
- protected ContextAccessor mapAcsr;
- protected ContextAccessor fieldAcsr;
+ protected ContextAccessor<Map<String, ? extends Object>> mapAcsr;
+ protected ContextAccessor<Object> fieldAcsr;
public IfNotEmpty(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
// NOTE: this is still supported, but is deprecated
- this.mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- this.fieldAcsr = new ContextAccessor(element.getAttribute("field"));
+ this.mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
+ this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field"));
if (this.fieldAcsr.isEmpty()) {
// NOTE: this is still supported, but is deprecated
- this.fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
}
SimpleMethod.readOperations(element, subOps, simpleMethod);
@@ -68,7 +68,7 @@
Object fieldVal = null;
if (!mapAcsr.isEmpty()) {
- Map fromMap = (Map) mapAcsr.get(methodContext);
+ Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
if (fromMap == null) {
if (Debug.verboseOn()) Debug.logVerbose("Map not found with name " + mapAcsr + ", not running operations", module);
} else {
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=682246&r1=682245&r2=682246&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 Aug 3 20:00:54 2008
@@ -43,15 +43,15 @@
List<MethodOperation> subOps = FastList.newInstance();
List<MethodOperation> elseSubOps = null;
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
+ ContextAccessor<Map<String, ? extends Object>> mapAcsr;
+ ContextAccessor<Object> fieldAcsr;
FlexibleStringExpander exprExdr;
public IfRegexp(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- this.mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- this.fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ this.mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
+ this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
this.exprExdr = new FlexibleStringExpander(element.getAttribute("expr"));
@@ -73,7 +73,7 @@
Object fieldVal = null;
if (!mapAcsr.isEmpty()) {
- Map fromMap = (Map) mapAcsr.get(methodContext);
+ Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
if (fromMap == null) {
if (Debug.infoOn()) Debug.logInfo("Map not found with name " + mapAcsr + ", using empty string for comparison", module);
} else {
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=682246&r1=682245&r2=682246&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 Aug 3 20:00:54 2008
@@ -39,15 +39,15 @@
List<MethodOperation> subOps = FastList.newInstance();
List<MethodOperation> elseSubOps = null;
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
+ ContextAccessor<Map<String, ? extends Object>> mapAcsr;
+ ContextAccessor<Object> fieldAcsr;
String methodName;
String className;
public IfValidateMethod(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- this.mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- this.fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ this.mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
+ this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
this.methodName = element.getAttribute("method");
this.className = element.getAttribute("class");
@@ -71,7 +71,7 @@
Object fieldVal = null;
if (!mapAcsr.isEmpty()) {
- Map fromMap = (Map) mapAcsr.get(methodContext);
+ Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
if (fromMap == null) {
if (Debug.infoOn()) Debug.logInfo("Map not found with name " + mapAcsr + ", using empty string for comparison", module);
} else {
@@ -93,10 +93,10 @@
// always use an empty string by default
if (fieldString == null) fieldString = "";
- Class[] paramTypes = new Class[] {String.class};
+ Class<?>[] paramTypes = new Class[] {String.class};
Object[] params = new Object[] {fieldString};
- Class valClass;
+ Class<?> valClass;
try {
valClass = methodContext.getLoader().loadClass(className);
} catch (ClassNotFoundException cnfe) {
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Calculate.java Sun Aug 3 20:00:54 2008
@@ -25,6 +25,8 @@
import java.util.List;
import java.util.Map;
+import javolution.util.FastMap;
+
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.UtilXml;
@@ -49,8 +51,8 @@
public static final int TYPE_STRING = 5;
public static final int TYPE_BIG_DECIMAL = 6;
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
+ ContextAccessor<Map<String, Object>> mapAcsr;
+ ContextAccessor<Object> fieldAcsr;
String decimalScaleString;
String decimalFormatString;
String typeString;
@@ -59,21 +61,19 @@
public Calculate(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name"));
+ fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
decimalScaleString = element.getAttribute("decimal-scale");
decimalFormatString = element.getAttribute("decimal-format");
typeString = element.getAttribute("type");
roundingModeString = element.getAttribute("rounding-mode");
- List calcopElements = UtilXml.childElementList(element);
+ List<? extends Element> calcopElements = UtilXml.childElementList(element);
calcops = new Calculate.SubCalc[calcopElements.size()];
- Iterator calcopIter = calcopElements.iterator();
int i = 0;
- while (calcopIter.hasNext()) {
- Element calcopElement = (Element) calcopIter.next();
+ for (Element calcopElement: calcopElements) {
String nodeName = calcopElement.getNodeName();
if ("calcop".equals(nodeName)) {
@@ -144,8 +144,8 @@
BigDecimal resultValue = ZERO;
resultValue = resultValue.setScale(decimalScale, roundingMode);
- for (int i = 0; i < calcops.length; i++) {
- resultValue = resultValue.add(calcops[i].calcValue(methodContext, decimalScale, roundingMode));
+ for (Calculate.SubCalc calcop: calcops) {
+ resultValue = resultValue.add(calcop.calcValue(methodContext, decimalScale, roundingMode));
// Debug.logInfo("main total so far: " + resultValue, module);
}
resultValue = resultValue.setScale(decimalScale, roundingMode);
@@ -196,10 +196,10 @@
}
if (!mapAcsr.isEmpty()) {
- Map toMap = (Map) mapAcsr.get(methodContext);
+ Map<String, Object> toMap = mapAcsr.get(methodContext);
if (toMap == null) {
if (Debug.verboseOn()) Debug.logVerbose("Map not found with name " + mapAcsr + ", creating new map", module);
- toMap = new HashMap();
+ toMap = FastMap.newInstance();
mapAcsr.put(methodContext, toMap);
}
fieldAcsr.put(toMap, resultObj, methodContext);
@@ -254,23 +254,21 @@
public static final int OPERATOR_DIVIDE = 4;
public static final int OPERATOR_NEGATIVE = 5;
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
+ ContextAccessor<Map<String, ? extends Object>> mapAcsr;
+ ContextAccessor<Object> fieldAcsr;
String operatorStr;
Calculate.SubCalc calcops[];
public CalcOp(Element element) {
- mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
+ fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
operatorStr = element.getAttribute("operator");
- List calcopElements = UtilXml.childElementList(element);
+ List<? extends Element> calcopElements = UtilXml.childElementList(element);
calcops = new Calculate.SubCalc[calcopElements.size()];
- Iterator calcopIter = calcopElements.iterator();
int i = 0;
- while (calcopIter.hasNext()) {
- Element calcopElement = (Element) calcopIter.next();
+ for (Element calcopElement: calcopElements) {
String nodeName = calcopElement.getNodeName();
if ("calcop".equals(calcopElement.getNodeName())) {
@@ -311,10 +309,10 @@
Object fieldObj = null;
if (!mapAcsr.isEmpty()) {
- Map fromMap = (Map) mapAcsr.get(methodContext);
+ Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
if (fromMap == null) {
if (Debug.verboseOn()) Debug.logVerbose("Map not found with name " + mapAcsr + ", creating new map", module);
- fromMap = new HashMap();
+ fromMap = FastMap.newInstance();
mapAcsr.put(methodContext, fromMap);
}
fieldObj = fieldAcsr.get(fromMap, methodContext);
@@ -343,25 +341,25 @@
}
}
- for (int i = 0; i < calcops.length; i++) {
+ for (SubCalc calcop: calcops) {
if (isFirst) {
- resultValue = calcops[i].calcValue(methodContext, scale, roundingMode);
+ resultValue = calcop.calcValue(methodContext, scale, roundingMode);
if (operator == OPERATOR_NEGATIVE) resultValue = resultValue.negate();
isFirst = false;
} else {
switch (operator) {
case OPERATOR_ADD:
- resultValue = resultValue.add(calcops[i].calcValue(methodContext, scale, roundingMode));
+ resultValue = resultValue.add(calcop.calcValue(methodContext, scale, roundingMode));
break;
case OPERATOR_SUBTRACT:
case OPERATOR_NEGATIVE:
- resultValue = resultValue.subtract(calcops[i].calcValue(methodContext, scale, roundingMode));
+ resultValue = resultValue.subtract(calcop.calcValue(methodContext, scale, roundingMode));
break;
case OPERATOR_MULTIPLY:
- resultValue = resultValue.multiply(calcops[i].calcValue(methodContext, scale, roundingMode));
+ resultValue = resultValue.multiply(calcop.calcValue(methodContext, scale, roundingMode));
break;
case OPERATOR_DIVIDE:
- resultValue = resultValue.divide(calcops[i].calcValue(methodContext, scale, roundingMode), scale, roundingMode);
+ resultValue = resultValue.divide(calcop.calcValue(methodContext, scale, roundingMode), scale, roundingMode);
break;
}
}
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Log.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Log.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Log.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/Log.java Sun Aug 3 20:00:54 2008
@@ -21,6 +21,7 @@
import java.util.*;
import org.w3c.dom.*;
+import javolution.util.FastList;
import org.ofbiz.base.util.*;
import org.ofbiz.minilang.*;
import org.ofbiz.minilang.method.*;
@@ -34,20 +35,18 @@
String levelStr;
String message;
- List methodStrings = null;
+ List<MethodString> methodStrings = null;
public Log(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
this.message = element.getAttribute("message");
this.levelStr = element.getAttribute("level");
- List methodStringElements = UtilXml.childElementList(element);
+ List<? extends Element> methodStringElements = UtilXml.childElementList(element);
if (methodStringElements.size() > 0) {
- methodStrings = new LinkedList();
+ methodStrings = FastList.newInstance();
- Iterator methodStringIter = methodStringElements.iterator();
- while (methodStringIter.hasNext()) {
- Element methodStringElement = (Element) methodStringIter.next();
+ for (Element methodStringElement: methodStringElements) {
if ("string".equals(methodStringElement.getNodeName())) {
methodStrings.add(new StringString(methodStringElement, simpleMethod));
} else if ("field".equals(methodStringElement.getNodeName())) {
@@ -78,14 +77,12 @@
return true;
}
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
if (message != null) buf.append(message);
if (methodStrings != null) {
- Iterator methodStringsIter = methodStrings.iterator();
- while (methodStringsIter.hasNext()) {
- MethodString methodString = (MethodString) methodStringsIter.next();
+ for (MethodString methodString: methodStrings) {
String strValue = methodString.getString(methodContext);
if (strValue != null) buf.append(strValue);
}
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/otherops/PropertyToField.java Sun Aug 3 20:00:54 2008
@@ -22,6 +22,7 @@
import java.util.*;
import org.w3c.dom.*;
+import javolution.util.FastMap;
import org.ofbiz.base.util.*;
import org.ofbiz.minilang.*;
import org.ofbiz.minilang.method.*;
@@ -35,22 +36,22 @@
String resource;
String property;
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
+ ContextAccessor<Map<String, Object>> mapAcsr;
+ ContextAccessor<Object> fieldAcsr;
String defaultVal;
boolean noLocale;
- ContextAccessor argListAcsr;
+ ContextAccessor<List<? extends Object>> argListAcsr;
public PropertyToField(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
resource = element.getAttribute("resource");
property = element.getAttribute("property");
- mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name"));
+ fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
defaultVal = element.getAttribute("default");
// defaults to false, ie anything but true is false
noLocale = "true".equals(element.getAttribute("no-locale"));
- argListAcsr = new ContextAccessor(element.getAttribute("arg-list-name"));
+ argListAcsr = new ContextAccessor<List<? extends Object>>(element.getAttribute("arg-list-name"));
}
public boolean exec(MethodContext methodContext) {
@@ -73,18 +74,18 @@
value = methodContext.expandString(value);
if (!argListAcsr.isEmpty()) {
- List argList = (List) argListAcsr.get(methodContext);
+ List<? extends Object> argList = argListAcsr.get(methodContext);
if (argList != null && argList.size() > 0) {
value = MessageFormat.format(value, argList.toArray());
}
}
if (!mapAcsr.isEmpty()) {
- Map toMap = (Map) mapAcsr.get(methodContext);
+ Map<String, Object> toMap = mapAcsr.get(methodContext);
if (toMap == null) {
if (Debug.infoOn()) Debug.logInfo("Map not found with name " + mapAcsr + ", creating new map", module);
- toMap = new HashMap();
+ toMap = FastMap.newInstance();
mapAcsr.put(methodContext, toMap);
}
fieldAcsr.put(toMap, value, methodContext);
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/serviceops/FieldToResult.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/serviceops/FieldToResult.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/serviceops/FieldToResult.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/serviceops/FieldToResult.java Sun Aug 3 20:00:54 2008
@@ -32,15 +32,15 @@
public static final String module = FieldToResult.class.getName();
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
- ContextAccessor resultAcsr;
+ ContextAccessor<Map<String, ? extends Object>> mapAcsr;
+ ContextAccessor<Object> fieldAcsr;
+ ContextAccessor<Object> resultAcsr;
public FieldToResult(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
- resultAcsr = new ContextAccessor(element.getAttribute("result-name"), element.getAttribute("field-name"));
+ mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
+ fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
+ resultAcsr = new ContextAccessor<Object>(element.getAttribute("result-name"), element.getAttribute("field-name"));
}
public boolean exec(MethodContext methodContext) {
@@ -49,7 +49,7 @@
Object fieldVal = null;
if (!mapAcsr.isEmpty()) {
- Map fromMap = (Map) mapAcsr.get(methodContext);
+ Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
if (fromMap == null) {
Debug.logWarning("Map not found with name " + mapAcsr, module);
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/BaseCompare.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/BaseCompare.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/BaseCompare.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/BaseCompare.java Sun Aug 3 20:00:54 2008
@@ -50,7 +50,7 @@
*/
}
- public void doCompare(Object value1, Object value2, List messages, Locale locale, ClassLoader loader, boolean value2InlineConstant) {
+ public void doCompare(Object value1, Object value2, List<Object> messages, Locale locale, ClassLoader loader, boolean value2InlineConstant) {
Boolean success = BaseCompare.doRealCompare(value1, value2, this.operator, this.type, this.format, messages, locale, loader, value2InlineConstant);
if (success != null && success.booleanValue() == false) {
@@ -58,10 +58,10 @@
}
}
- public void exec(Map inMap, Map results, List messages, Locale locale, ClassLoader loader) {}
+ public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {}
public static Boolean doRealCompare(Object value1, Object value2, String operator, String type, String format,
- List messages, Locale locale, ClassLoader loader, boolean value2InlineConstant) {
+ List<Object> messages, Locale locale, ClassLoader loader, boolean value2InlineConstant) {
return ObjectType.doRealCompare(value1, value2, operator, type, format, messages, locale, loader, value2InlineConstant);
}
}
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Compare.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Compare.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Compare.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Compare.java Sun Aug 3 20:00:54 2008
@@ -33,7 +33,7 @@
this.value = element.getAttribute("value");
}
- public void exec(Map inMap, Map results, List messages, Locale locale, ClassLoader loader) {
+ public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {
Object fieldValue = inMap.get(fieldName);
doCompare(fieldValue, value, messages, locale, loader, true);
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/CompareField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/CompareField.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/CompareField.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/CompareField.java Sun Aug 3 20:00:54 2008
@@ -33,7 +33,7 @@
this.compareName = element.getAttribute("field");
}
- public void exec(Map inMap, Map results, List messages, Locale locale, ClassLoader loader) {
+ public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {
Object compareValue = inMap.get(compareName);
Object fieldValue = inMap.get(fieldName);
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/ConstantOper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/ConstantOper.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/ConstantOper.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/ConstantOper.java Sun Aug 3 20:00:54 2008
@@ -35,7 +35,7 @@
constant = UtilXml.elementValue(element);
}
- public String exec(Map inMap, List messages, Locale locale, ClassLoader loader) {
+ public String exec(Map<String, Object> inMap, List<Object> messages, Locale locale, ClassLoader loader) {
return constant;
}
}
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Convert.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Convert.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Convert.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Convert.java Sun Aug 3 20:00:54 2008
@@ -55,7 +55,7 @@
format = element.getAttribute("format");
}
- public void exec(Map inMap, Map results, List messages, Locale locale, ClassLoader loader) {
+ public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {
Object fieldObject = inMap.get(fieldName);
if (fieldObject == null) {
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Copy.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Copy.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Copy.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Copy.java Sun Aug 3 20:00:54 2008
@@ -43,7 +43,7 @@
setIfNull = !"false".equals(element.getAttribute("set-if-null"));
}
- public void exec(Map inMap, Map results, List messages, Locale locale, ClassLoader loader) {
+ public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {
Object fieldValue = inMap.get(fieldName);
if (fieldValue == null && !setIfNull)
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/InFieldOper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/InFieldOper.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/InFieldOper.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/InFieldOper.java Sun Aug 3 20:00:54 2008
@@ -37,7 +37,7 @@
fieldName = element.getAttribute("field");
}
- public String exec(Map inMap, List messages, Locale locale, ClassLoader loader) {
+ public String exec(Map<String, Object> inMap, List<Object> messages, Locale locale, ClassLoader loader) {
Object obj = inMap.get(fieldName);
if (obj == null) {
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MakeInString.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MakeInString.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MakeInString.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MakeInString.java Sun Aug 3 20:00:54 2008
@@ -20,6 +20,8 @@
import java.util.*;
+import javolution.util.FastList;
+
import org.w3c.dom.*;
import org.ofbiz.base.util.*;
@@ -31,18 +33,15 @@
public static final String module = MakeInString.class.getName();
String fieldName;
- List operations = new LinkedList();
+ List<MakeInStringOperation> operations = FastList.newInstance();
public MakeInString(Element makeInStringElement) {
fieldName = makeInStringElement.getAttribute("field");
- List operationElements = UtilXml.childElementList(makeInStringElement);
+ List<? extends Element> operationElements = UtilXml.childElementList(makeInStringElement);
if (operationElements != null && operationElements.size() > 0) {
- Iterator operElemIter = operationElements.iterator();
-
- while (operElemIter.hasNext()) {
- Element curOperElem = (Element) operElemIter.next();
+ for (Element curOperElem: operationElements) {
String nodeName = curOperElem.getNodeName();
if ("in-field".equals(nodeName)) {
@@ -58,12 +57,9 @@
}
}
- public void exec(Map inMap, Map results, List messages, Locale locale, ClassLoader loader) {
- Iterator iter = operations.iterator();
- StringBuffer buffer = new StringBuffer();
-
- while (iter.hasNext()) {
- MakeInStringOperation oper = (MakeInStringOperation) iter.next();
+ public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {
+ StringBuilder buffer = new StringBuilder();
+ for (MakeInStringOperation oper: operations) {
String curStr = oper.exec(inMap, messages, locale, loader);
if (curStr != null)
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MakeInStringOperation.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MakeInStringOperation.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MakeInStringOperation.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MakeInStringOperation.java Sun Aug 3 20:00:54 2008
@@ -28,5 +28,5 @@
public MakeInStringOperation(Element element) {}
- public abstract String exec(Map inMap, List messages, Locale locale, ClassLoader loader);
+ public abstract String exec(Map<String, Object> inMap, List<Object> messages, Locale locale, ClassLoader loader);
}
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MapProcessor.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MapProcessor.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MapProcessor.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/MapProcessor.java Sun Aug 3 20:00:54 2008
@@ -20,6 +20,7 @@
import java.util.*;
+import javolution.util.FastList;
import org.w3c.dom.*;
import org.ofbiz.base.util.*;
@@ -29,27 +30,19 @@
public class MapProcessor {
String name;
- List makeInStrings = new LinkedList();
- List simpleMapProcesses = new LinkedList();
+ List<MakeInString> makeInStrings = FastList.newInstance();
+ List<SimpleMapProcess> simpleMapProcesses = FastList.newInstance();
public MapProcessor(Element simpleMapProcessorElement) {
name = simpleMapProcessorElement.getAttribute("name");
- List makeInStringElements = UtilXml.childElementList(simpleMapProcessorElement, "make-in-string");
- Iterator misIter = makeInStringElements.iterator();
-
- while (misIter.hasNext()) {
- Element makeInStringElement = (Element) misIter.next();
+ for (Element makeInStringElement: UtilXml.childElementList(simpleMapProcessorElement, "make-in-string")) {
MakeInString makeInString = new MakeInString(makeInStringElement);
makeInStrings.add(makeInString);
}
- List simpleMapProcessElements = UtilXml.childElementList(simpleMapProcessorElement, "process");
- Iterator strProcIter = simpleMapProcessElements.iterator();
-
- while (strProcIter.hasNext()) {
- Element simpleMapProcessElement = (Element) strProcIter.next();
+ for (Element simpleMapProcessElement: UtilXml.childElementList(simpleMapProcessorElement, "process")) {
SimpleMapProcess strProc = new SimpleMapProcess(simpleMapProcessElement);
simpleMapProcesses.add(strProc);
@@ -60,23 +53,15 @@
return name;
}
- public void exec(Map inMap, Map results, List messages, Locale locale, ClassLoader loader) {
+ public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {
if (makeInStrings != null && makeInStrings.size() > 0) {
- Iterator misIter = makeInStrings.iterator();
-
- while (misIter.hasNext()) {
- MakeInString makeInString = (MakeInString) misIter.next();
-
+ for (MakeInString makeInString: makeInStrings) {
makeInString.exec(inMap, results, messages, locale, loader);
}
}
if (simpleMapProcesses != null && simpleMapProcesses.size() > 0) {
- Iterator strPrsIter = simpleMapProcesses.iterator();
-
- while (strPrsIter.hasNext()) {
- SimpleMapProcess simpleMapProcess = (SimpleMapProcess) strPrsIter.next();
-
+ for (SimpleMapProcess simpleMapProcess: simpleMapProcesses) {
simpleMapProcess.exec(inMap, results, messages, locale, loader);
}
}
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/NotEmpty.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/NotEmpty.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/NotEmpty.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/NotEmpty.java Sun Aug 3 20:00:54 2008
@@ -32,7 +32,7 @@
super(element, simpleMapProcess);
}
- public void exec(Map inMap, Map results, List messages, Locale locale, ClassLoader loader) {
+ public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {
Object obj = inMap.get(fieldName);
if (obj instanceof java.lang.String) {
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Regexp.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Regexp.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Regexp.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/Regexp.java Sun Aug 3 20:00:54 2008
@@ -47,7 +47,7 @@
}
}
- public void exec(Map inMap, Map results, List messages, Locale locale, ClassLoader loader) {
+ public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {
Object obj = inMap.get(fieldName);
String fieldValue = null;
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapOperation.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapOperation.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapOperation.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapOperation.java Sun Aug 3 20:00:54 2008
@@ -51,9 +51,9 @@
this.fieldName = simpleMapProcess.getFieldName();
}
- public abstract void exec(Map inMap, Map results, List messages, Locale locale, ClassLoader loader);
+ public abstract void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader);
- public void addMessage(List messages, ClassLoader loader, Locale locale) {
+ public void addMessage(List<Object> messages, ClassLoader loader, Locale locale) {
if (!isProperty && message != null) {
messages.add(new MessageString(message, fieldName, true));
// if (Debug.infoOn()) Debug.logInfo("[SimpleMapOperation.addMessage] Adding message: " + message, module);
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapProcess.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapProcess.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapProcess.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/SimpleMapProcess.java Sun Aug 3 20:00:54 2008
@@ -20,6 +20,8 @@
import java.util.*;
+import javolution.util.FastList;
+
import org.w3c.dom.*;
import org.ofbiz.base.util.*;
@@ -30,7 +32,7 @@
public static final String module = SimpleMapProcess.class.getName();
- List simpleMapOperations = new LinkedList();
+ List<SimpleMapOperation> simpleMapOperations = FastList.newInstance();
String field = "";
public SimpleMapProcess(Element simpleMapProcessElement) {
@@ -42,24 +44,17 @@
return field;
}
- public void exec(Map inMap, Map results, List messages, Locale locale, ClassLoader loader) {
- Iterator strOpsIter = simpleMapOperations.iterator();
-
- while (strOpsIter.hasNext()) {
- SimpleMapOperation simpleMapOperation = (SimpleMapOperation) strOpsIter.next();
-
+ public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {
+ for (SimpleMapOperation simpleMapOperation: simpleMapOperations) {
simpleMapOperation.exec(inMap, results, messages, locale, loader);
}
}
void readOperations(Element simpleMapProcessElement) {
- List operationElements = UtilXml.childElementList(simpleMapProcessElement);
+ List<? extends Element> operationElements = UtilXml.childElementList(simpleMapProcessElement);
if (operationElements != null && operationElements.size() > 0) {
- Iterator operElemIter = operationElements.iterator();
-
- while (operElemIter.hasNext()) {
- Element curOperElem = (Element) operElemIter.next();
+ for (Element curOperElem: operationElements) {
String nodeName = curOperElem.getNodeName();
if ("validate-method".equals(nodeName)) {
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/ValidateMethod.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/ValidateMethod.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/ValidateMethod.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/operation/ValidateMethod.java Sun Aug 3 20:00:54 2008
@@ -41,7 +41,7 @@
this.className = element.getAttribute("class");
}
- public void exec(Map inMap, Map results, List messages, Locale locale, ClassLoader loader) {
+ public void exec(Map<String, Object> inMap, Map<String, Object> results, List<Object> messages, Locale locale, ClassLoader loader) {
Object obj = inMap.get(fieldName);
String fieldValue = null;
@@ -57,10 +57,10 @@
loader = Thread.currentThread().getContextClassLoader();
}
- Class[] paramTypes = new Class[] {String.class};
+ Class<?>[] paramTypes = new Class<?>[] {String.class};
Object[] params = new Object[] {fieldValue};
- Class valClass;
+ Class<?> valClass;
try {
valClass = loader.loadClass(className);