commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcucchi...@apache.org
Subject svn commit: r1197452 - /commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/MapPropertyAccessor.java
Date Fri, 04 Nov 2011 09:18:37 GMT
Author: mcucchiara
Date: Fri Nov  4 09:18:36 2011
New Revision: 1197452

URL: http://svn.apache.org/viewvc?rev=1197452&view=rev
Log:
OGNL-35 - Flipped equals() everywhere where a variable is tested against a String constant.

Modified:
    commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/MapPropertyAccessor.java

Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/MapPropertyAccessor.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/MapPropertyAccessor.java?rev=1197452&r1=1197451&r2=1197452&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/MapPropertyAccessor.java
(original)
+++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/MapPropertyAccessor.java
Fri Nov  4 09:18:36 2011
@@ -25,7 +25,8 @@ import java.util.Set;
 
 /**
  * Implementation of PropertyAccessor that sets and gets properties by storing and looking
up values in Maps.
- * 
+ *
+ * $Id$
  * @author Luke Blanshard (blanshlu@netscape.net)
  * @author Drew Davidson (drew@ognl.org)
  */
@@ -57,25 +58,25 @@ public class MapPropertyAccessor
 
         if ( ( name instanceof String ) && !indexedAccess )
         {
-            if ( name.equals( "size" ) )
+            if ( "size".equals( name ) )
             {
-                result = Integer.valueOf( map.size() );
+                result = map.size();
             }
             else
             {
-                if ( name.equals( "keys" ) || name.equals( "keySet" ) )
+                if ( "keys".equals( name ) || "keySet".equals( name ) )
                 {
                     result = map.keySet();
                 }
                 else
                 {
-                    if ( name.equals( "values" ) )
+                    if ( "values".equals( name ) )
                     {
                         result = map.values();
                     }
                     else
                     {
-                        if ( name.equals( "isEmpty" ) )
+                        if ( "isEmpty".equals( name ) )
                         {
                             result = map.isEmpty() ? Boolean.TRUE : Boolean.FALSE;
                         }
@@ -132,22 +133,22 @@ public class MapPropertyAccessor
         {
             String key = indexStr.replaceAll( "\"", "" );
 
-            if ( key.equals( "size" ) )
+            if ( "size".equals( key ) )
             {
                 context.setCurrentType( int.class );
                 return ".size()";
             }
-            else if ( key.equals( "keys" ) || key.equals( "keySet" ) )
+            else if ( "keys".equals( key ) || "keySet".equals( key ) )
             {
                 context.setCurrentType( Set.class );
                 return ".keySet()";
             }
-            else if ( key.equals( "values" ) )
+            else if ( "values".equals( key ) )
             {
                 context.setCurrentType( Collection.class );
                 return ".values()";
             }
-            else if ( key.equals( "isEmpty" ) )
+            else if ( "isEmpty".equals( key ) )
             {
                 context.setCurrentType( boolean.class );
                 return ".isEmpty()";
@@ -168,19 +169,19 @@ public class MapPropertyAccessor
         {
             String key = indexStr.replaceAll( "\"", "" );
 
-            if ( key.equals( "size" ) )
+            if ( "size".equals( key ) )
             {
                 return "";
             }
-            else if ( key.equals( "keys" ) || key.equals( "keySet" ) )
+            else if ( "keys".equals( key ) || "keySet".equals( key ) )
             {
                 return "";
             }
-            else if ( key.equals( "values" ) )
+            else if ( "values".equals( key ) )
             {
                 return "";
             }
-            else if ( key.equals( "isEmpty" ) )
+            else if ( "isEmpty".equals( key ) )
             {
                 return "";
             }



Mime
View raw message