commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r564643 - /commons/proper/el/trunk/src/java/org/apache/commons/el/ExpressionEvaluatorImpl.java
Date Fri, 10 Aug 2007 16:10:49 GMT
Author: mbenson
Date: Fri Aug 10 09:10:48 2007
New Revision: 564643

URL: http://svn.apache.org/viewvc?view=rev&rev=564643
Log:
unnecessary elses

Modified:
    commons/proper/el/trunk/src/java/org/apache/commons/el/ExpressionEvaluatorImpl.java

Modified: commons/proper/el/trunk/src/java/org/apache/commons/el/ExpressionEvaluatorImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/el/trunk/src/java/org/apache/commons/el/ExpressionEvaluatorImpl.java?view=diff&rev=564643&r1=564642&r2=564643
==============================================================================
--- commons/proper/el/trunk/src/java/org/apache/commons/el/ExpressionEvaluatorImpl.java (original)
+++ commons/proper/el/trunk/src/java/org/apache/commons/el/ExpressionEvaluatorImpl.java Fri
Aug 10 09:10:48 2007
@@ -193,24 +193,22 @@
             return convertStaticValueToExpectedType(strValue, pExpectedType);
         }
 
-        else if (parsedValue instanceof Expression) {
+        if (parsedValue instanceof Expression) {
             // Evaluate the expression and convert
             Object value = ((Expression) parsedValue).evaluate(pResolver,
                     functions);
             return convertToExpectedType(value, pExpectedType);
         }
 
-        else if (parsedValue instanceof ExpressionString) {
+        if (parsedValue instanceof ExpressionString) {
             // Evaluate the expression/string list and convert
             String strValue = ((ExpressionString) parsedValue).evaluate(
                     pResolver, functions);
             return convertToExpectedType(strValue, pExpectedType);
         }
 
-        else {
-            // This should never be reached
-            return null;
-        }
+        // This should never be reached
+        return null;
     }
 
     // -------------------------------------
@@ -280,12 +278,11 @@
         Map valueByString = getOrCreateExpectedTypeMap(pExpectedType);
         if (!mBypassCache && valueByString.containsKey(pValue)) {
             return valueByString.get(pValue);
-        } else {
-            // Convert from a String
-            Object ret = Coercions.coerce(pValue, pExpectedType);
-            valueByString.put(pValue, ret);
-            return ret;
         }
+        // else Convert from a String
+        Object ret = Coercions.coerce(pValue, pExpectedType);
+        valueByString.put(pValue, ret);
+        return ret;
     }
 
     // -------------------------------------
@@ -411,15 +408,13 @@
      **/
     public String parseAndRender(String pExpressionString) throws ELException {
         Object val = parseExpressionString(pExpressionString);
-        if (val instanceof String) {
-            return (String) val;
-        } else if (val instanceof Expression) {
+        if (val instanceof Expression) {
             return "${" + ((Expression) val).getExpressionString() + "}";
-        } else if (val instanceof ExpressionString) {
+        }
+        if (val instanceof ExpressionString) {
             return ((ExpressionString) val).getExpressionString();
-        } else {
-            return "";
         }
+        return val instanceof String ? (String) val : "";
     }
 
     /**
@@ -431,8 +426,8 @@
         private Class expectedType;
         private FunctionMapper fMapper;
 
-        private JSTLExpression(String expression,
-                Class expectedType, FunctionMapper fMapper) {
+        private JSTLExpression(String expression, Class expectedType,
+                FunctionMapper fMapper) {
             this.expression = expression;
             this.expectedType = expectedType;
             this.fMapper = fMapper;



Mime
View raw message