Author: adrianc
Date: Sat Dec 13 10:46:35 2008 New Revision: 726254 URL: http://svn.apache.org/viewvc?rev=726254&view=rev Log: Implemented FlexibleMapAccessor.getInstance() in mini language. Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ContextAccessor.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodContext.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/OrderMapList.java Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ContextAccessor.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ContextAccessor.java?rev=726254&r1=726253&r2=726254&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ContextAccessor.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ContextAccessor.java Sat Dec 13 10:46:35 2008 @@ -52,7 +52,7 @@ if (name == null || name.length() == 0) { empty = true; needsExpand = false; - fma = new FlexibleMapAccessor<T>(name); + fma = FlexibleMapAccessor.getInstance(name); } else { empty = false; int openPos = name.indexOf("${"); @@ -60,7 +60,7 @@ fma = null; needsExpand = true; } else { - fma = new FlexibleMapAccessor<T>(name); + fma = FlexibleMapAccessor.getInstance(name); needsExpand = false; } } @@ -105,7 +105,7 @@ /** Based on name get from Map or from List in Map */ public T get(Map<String, ? extends Object> theMap, MethodContext methodContext) { if (this.needsExpand) { - FlexibleMapAccessor<T> fma = new FlexibleMapAccessor<T>(methodContext.expandString(name)); + FlexibleMapAccessor<T> fma = FlexibleMapAccessor.getInstance(methodContext.expandString(name)); return fma.get(theMap); } else { return fma.get(theMap); @@ -120,7 +120,7 @@ */ public void put(Map<String, Object> theMap, T value, MethodContext methodContext) { if (this.needsExpand) { - FlexibleMapAccessor<T> fma = new FlexibleMapAccessor<T>(methodContext.expandString(name)); + FlexibleMapAccessor<T> fma = FlexibleMapAccessor.getInstance(methodContext.expandString(name)); fma.put(theMap, value); } else { fma.put(theMap, value); @@ -130,7 +130,7 @@ /** Based on name remove from Map or from List in Map */ public T remove(Map<String, ? extends Object> theMap, MethodContext methodContext) { if (this.needsExpand) { - FlexibleMapAccessor<T> fma = new FlexibleMapAccessor<T>(methodContext.expandString(name)); + FlexibleMapAccessor<T> fma = FlexibleMapAccessor.getInstance(methodContext.expandString(name)); return fma.remove(theMap); } else { return fma.remove(theMap); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodContext.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodContext.java?rev=726254&r1=726253&r2=726254&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodContext.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodContext.java Sat Dec 13 10:46:35 2008 @@ -180,7 +180,7 @@ */ public <T> T getEnv(String key) { String ekey = this.expandString(key); - FlexibleMapAccessor<T> fma = new FlexibleMapAccessor<T>(ekey); + FlexibleMapAccessor<T> fma = FlexibleMapAccessor.getInstance(ekey); return this.getEnv(fma); } public <T> T getEnv(FlexibleMapAccessor<T> fma) { @@ -201,7 +201,7 @@ */ public <T> void putEnv(String key, T value) { String ekey = this.expandString(key); - FlexibleMapAccessor<T> fma = new FlexibleMapAccessor<T>(ekey); + FlexibleMapAccessor<T> fma = FlexibleMapAccessor.getInstance(ekey); this.putEnv(fma, value); } public <T> void putEnv(FlexibleMapAccessor<T> fma, T value) { @@ -225,7 +225,7 @@ */ public <T> T removeEnv(String key) { String ekey = this.expandString(key); - FlexibleMapAccessor<T> fma = new FlexibleMapAccessor<T>(ekey); + FlexibleMapAccessor<T> fma = FlexibleMapAccessor.getInstance(ekey); return this.removeEnv(fma); } public <T> T removeEnv(FlexibleMapAccessor<T> fma) { Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java?rev=726254&r1=726253&r2=726254&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java Sat Dec 13 10:46:35 2008 @@ -62,7 +62,7 @@ super(element, simpleMethod); this.entityNameExdr = FlexibleStringExpander.getInstance(element.getAttribute("entity-name")); this.delegatorNameExdr = FlexibleStringExpander.getInstance(element.getAttribute("delegator-name")); - this.countAcsr = new FlexibleMapAccessor<Long>(element.getAttribute("count-name")); + this.countAcsr = FlexibleMapAccessor.getInstance(element.getAttribute("count-name")); // process condition-expr | condition-list Element conditionExprElement = UtilXml.firstChildElement(element, "condition-expr"); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/OrderMapList.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/OrderMapList.java?rev=726254&r1=726253&r2=726254&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/OrderMapList.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/OrderMapList.java Sat Dec 13 10:46:35 2008 @@ -54,7 +54,8 @@ listAcsr = new ContextAccessor<List<Map<Object, Object>>>(element.getAttribute("list-name")); for (Element orderByElement: UtilXml.childElementList(element, "order-by")) { - this.orderByAcsrList.add(new FlexibleMapAccessor<String>(orderByElement.getAttribute("field-name"))); + FlexibleMapAccessor<String> fma = FlexibleMapAccessor.getInstance(orderByElement.getAttribute("field-name")); + this.orderByAcsrList.add(fma); } this.mc = new MapComparator(this.orderByAcsrList); |
Free forum by Nabble | Edit this page |