commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcucchi...@apache.org
Subject svn commit: r1194866 - /commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/
Date Sat, 29 Oct 2011 10:51:33 GMT
Author: mcucchiara
Date: Sat Oct 29 10:51:32 2011
New Revision: 1194866

URL: http://svn.apache.org/viewvc?rev=1194866&view=rev
Log:
OGNL-11: fixed checkstyle errors

Modified:
    commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTAdd.java
    commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTList.java
    commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTMethodUtil.java
    commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTProperty.java
    commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ArrayPropertyAccessor.java
    commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultClassResolver.java
    commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultTypeConverter.java
    commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/JJTOgnlParserState.java
    commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/JavaSource.java
    commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ListPropertyAccessor.java
    commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/Node.java
    commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/NodeVisitor.java
    commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/NumericExpression.java
    commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectMethodAccessor.java
    commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectPropertyAccessor.java
    commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/Ognl.java
    commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlContext.java

Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTAdd.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTAdd.java?rev=1194866&r1=1194865&r2=1194866&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTAdd.java (original)
+++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTAdd.java Sat Oct 29 10:51:32 2011
@@ -316,14 +316,14 @@ class ASTAdd
 
             if ( _parent == null || ASTSequence.class.isAssignableFrom( _parent.getClass() ) )
             {
-                if ( _getterClass != null && String.class.isAssignableFrom( _getterClass ) )
+                if ( getterClass != null && String.class.isAssignableFrom( getterClass ) )
                 {
-                    _getterClass = Object.class;
+                    getterClass = Object.class;
                 }
             }
             else
             {
-                context.setCurrentType( _getterClass );
+                context.setCurrentType( getterClass );
             }
 
             try

Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTList.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTList.java?rev=1194866&r1=1194865&r2=1194866&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTList.java (original)
+++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTList.java Sat Oct 29 10:51:32 2011
@@ -20,6 +20,7 @@ package org.apache.commons.ognl;
  */
 
 import org.apache.commons.ognl.enhance.ExpressionCompiler;
+import org.apache.commons.ognl.enhance.OgnlExpressionCompiler;
 import org.apache.commons.ognl.enhance.UnsupportedCompilationException;
 
 import java.util.ArrayList;
@@ -138,12 +139,12 @@ public class ASTList
                     {
                         valueClass = ( (NodeType) _children[i] ).getGetterClass();
                     }
+                    final OgnlExpressionCompiler compiler = OgnlRuntime.getCompiler( context );
                     if ( valueClass != null && ctorClass.isArray() )
                     {
 
                         value =
-                            OgnlRuntime
-                                .getCompiler( context )
+                            compiler
                                 .createLocalReference( context, "(" + ExpressionCompiler.getCastString( ctorClass )
                                     + ")org.apache.commons.ognl.OgnlOps.toArray(" + value + ", "
                                     + ctorClass.getComponentType().getName() + ".class, true)", ctorClass );
@@ -155,8 +156,7 @@ public class ASTList
                         Class wrapClass = OgnlRuntime.getPrimitiveWrapperClass( ctorClass );
 
                         value =
-                            OgnlRuntime
-                                .getCompiler( context )
+                            compiler
                                 .createLocalReference( context, "((" + wrapClass.getName()
                                     + ")org.apache.commons.ognl.OgnlOps.convertValue(" + value + ","
                                     + wrapClass.getName() + ".class, true))." + OgnlRuntime.getNumericValueGetter(
@@ -166,8 +166,7 @@ public class ASTList
                     {
 
                         value =
-                            OgnlRuntime
-                                .getCompiler( context )
+                            compiler
                                 .createLocalReference( context, "(" + ctorClass.getName()
                                     + ")org.apache.commons.ognl.OgnlOps.convertValue(" + value + ","
                                     + ctorClass.getName() + ".class)", ctorClass );

Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTMethodUtil.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTMethodUtil.java?rev=1194866&r1=1194865&r2=1194866&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTMethodUtil.java (original)
+++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTMethodUtil.java Sat Oct 29 10:51:32 2011
@@ -1,8 +1,5 @@
 package org.apache.commons.ognl;
 
-import org.apache.commons.ognl.enhance.ExpressionCompiler;
-import org.apache.commons.ognl.enhance.OgnlExpressionCompiler;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -22,6 +19,10 @@ import org.apache.commons.ognl.enhance.O
  * under the License.
  */
 
+import org.apache.commons.ognl.enhance.ExpressionCompiler;
+import org.apache.commons.ognl.enhance.OgnlExpressionCompiler;
+
+
 /**
  * $Id$
  */

Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTProperty.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTProperty.java?rev=1194866&r1=1194865&r2=1194866&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTProperty.java (original)
+++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTProperty.java Sat Oct 29 10:51:32 2011
@@ -389,10 +389,9 @@ public class ASTProperty
     Object getTarget( OgnlContext context, Object target, String name )
         throws OgnlException
     {
-        Class<? extends Object> clazz = context.getCurrentObject().getClass();
-        if ( !Iterator.class.isAssignableFrom(clazz)
-            || ( Iterator.class.isAssignableFrom(clazz)
-                 && name.indexOf( "next" ) < 0 ) )
+        Class<?> clazz = context.getCurrentObject().getClass();
+        if ( !Iterator.class.isAssignableFrom( clazz ) || ( Iterator.class.isAssignableFrom( clazz ) && !name.contains(
+            "next" ) ) )
         {
             Object currObj = target;
 

Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ArrayPropertyAccessor.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ArrayPropertyAccessor.java?rev=1194866&r1=1194865&r2=1194866&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ArrayPropertyAccessor.java (original)
+++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ArrayPropertyAccessor.java Sat Oct 29 10:51:32 2011
@@ -209,7 +209,7 @@ public class ArrayPropertyAccessor
             indexStr = "org.apache.commons.ognl.OgnlOps#getIntValue(" + indexStr + toString + ")";
         }
 
-        Class<? extends Object> type = target.getClass().isArray() ? target.getClass().getComponentType() : target.getClass();
+        Class<?> type = target.getClass().isArray() ? target.getClass().getComponentType() : target.getClass();
 
         context.setCurrentAccessor( target.getClass() );
         context.setCurrentType( target.getClass().getComponentType() );

Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultClassResolver.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultClassResolver.java?rev=1194866&r1=1194865&r2=1194866&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultClassResolver.java (original)
+++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultClassResolver.java Sat Oct 29 10:51:32 2011
@@ -23,7 +23,8 @@ import java.util.HashMap;
 import java.util.Map;
 
 /**
- * Default class resolution. Uses ClassLoader.loadClass() to look up classes by name. It also looks in the "java.lang" package
+ * Default class resolution. Uses ClassLoader.loadClass() to look up classes by name. It also looks in the "java.lang"
+ * package
  * if the class named does not give a package specifier, allowing easier usage of these classes.
  *
  * @author Luke Blanshard (blanshlu@netscape.net)

Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultTypeConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultTypeConverter.java?rev=1194866&r1=1194865&r2=1194866&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultTypeConverter.java (original)
+++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultTypeConverter.java Sat Oct 29 10:51:32 2011
@@ -43,8 +43,8 @@ public class DefaultTypeConverter
     /**
      * {@inheritDoc}
      */
-    public <T> T convertValue( Map<String, Object> context, Object target, Member member, String propertyName, Object value,
-                                Class<T> toType )
+    public <T> T convertValue( Map<String, Object> context, Object target, Member member, String propertyName,
+                               Object value, Class<T> toType )
         throws OgnlException
     {
         return convertValue( context, value, toType );

Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/JJTOgnlParserState.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/JJTOgnlParserState.java?rev=1194866&r1=1194865&r2=1194866&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/JJTOgnlParserState.java (original)
+++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/JJTOgnlParserState.java Sat Oct 29 10:51:32 2011
@@ -1,3 +1,5 @@
+package org.apache.commons.ognl;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,7 +20,6 @@
  */
 
 /* Generated By:JavaCC: Do not edit this line. JJTOgnlParserState.java Version 4.1d1 */
-package org.apache.commons.ognl;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -118,7 +119,7 @@ public class JJTOgnlParserState
 
     public void openNodeScope( Node node )
     {
-        marks.add(currentMark);
+        marks.add( currentMark );
         currentMark = numNodesOnStack;
         node.jjtOpen();
     }

Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/JavaSource.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/JavaSource.java?rev=1194866&r1=1194865&r2=1194866&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/JavaSource.java (original)
+++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/JavaSource.java Sat Oct 29 10:51:32 2011
@@ -22,7 +22,7 @@ package org.apache.commons.ognl;
 /**
  * Defines an object that can return a representation of itself and any objects it contains in the form of a
  * {@link String} embedded with literal java statements.
- * 
+ *
  * @author jkuhnert
  */
 public interface JavaSource
@@ -30,16 +30,18 @@ public interface JavaSource
 
     /**
      * Expected to return a java source representation of itself such that it could be turned into a literal java
-     * expression to be compiled and executed for {@link org.apache.commons.ognl.enhance.ExpressionAccessor#get(OgnlContext, Object)} calls.
-     * 
+     * expression to be compiled and executed for
+     * {@link org.apache.commons.ognl.enhance.ExpressionAccessor#get(OgnlContext, Object)} calls.
+     *
      * @return Literal java string representation of an object get.
      */
     String toGetSourceString( OgnlContext context, Object target );
 
     /**
      * Expected to return a java source representation of itself such that it could be turned into a literal java
-     * expression to be compiled and executed for {@link org.apache.commons.ognl.enhance.ExpressionAccessor#get(OgnlContext, Object)} calls.
-     * 
+     * expression to be compiled and executed for
+     * {@link org.apache.commons.ognl.enhance.ExpressionAccessor#get(OgnlContext, Object)} calls.
+     *
      * @return Literal java string representation of an object get.
      */
     String toSetSourceString( OgnlContext context, Object target );

Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ListPropertyAccessor.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ListPropertyAccessor.java?rev=1194866&r1=1194865&r2=1194866&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ListPropertyAccessor.java (original)
+++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ListPropertyAccessor.java Sat Oct 29 10:51:32 2011
@@ -142,7 +142,6 @@ public class ListPropertyAccessor
                     }
                     return;
                 case DynamicSubscript.ALL:
-                {
                     if ( !( value instanceof Collection ) )
                     {
                         throw new OgnlException( "Value must be a collection" );
@@ -150,7 +149,8 @@ public class ListPropertyAccessor
                     list.clear();
                     list.addAll( (Collection<?>) value );
                     return;
-                }
+                default:
+                    return;
             }
         }
 

Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/Node.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/Node.java?rev=1194866&r1=1194865&r2=1194866&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/Node.java (original)
+++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/Node.java Sat Oct 29 10:51:32 2011
@@ -96,15 +96,16 @@ public interface Node
     /**
      * Supports the Visitor pattern. The method which corresponds to
      * the runtime type of this Node will be called.
+     *
      * @param visitor The visitor to accept.
-     * @param data The second parameter to pass through to visitor.visit
-     * @param <R> The return type of the visitor.visit method.
-     * @param <P> The type of the second parameter type.
+     * @param data    The second parameter to pass through to visitor.visit
+     * @param <R>     The return type of the visitor.visit method.
+     * @param <P>     The type of the second parameter type.
      * @return the value returned by visitor.visit
      * @throws NullPointerException if visitor is null
-     * @throws RuntimeException if visitor.visit throws an exception.
+     * @throws RuntimeException     if visitor.visit throws an exception.
      */
-    <R,P> R accept(NodeVisitor<? extends R, ? super P> visitor, P data)
+    <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data )
         throws OgnlException;
 
 }

Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/NodeVisitor.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/NodeVisitor.java?rev=1194866&r1=1194865&r2=1194866&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/NodeVisitor.java (original)
+++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/NodeVisitor.java Sat Oct 29 10:51:32 2011
@@ -1,8 +1,6 @@
 package org.apache.commons.ognl;
 
 /*
- * $Id$
- *
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -21,6 +19,9 @@ package org.apache.commons.ognl;
  * under the License.
  */
 
+/*
+*  $Id$
+*/
 public interface NodeVisitor<R, P>
 {
     R visit( ASTSequence node, P data )

Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/NumericExpression.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/NumericExpression.java?rev=1194866&r1=1194865&r2=1194866&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/NumericExpression.java (original)
+++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/NumericExpression.java Sat Oct 29 10:51:32 2011
@@ -31,7 +31,7 @@ public abstract class NumericExpression
 
     private static final long serialVersionUID = -174952564587478850L;
 
-    protected Class<?> _getterClass;
+    protected Class<?> getterClass;
 
     public NumericExpression( int id )
     {
@@ -48,9 +48,9 @@ public abstract class NumericExpression
      */
     public Class<?> getGetterClass()
     {
-        if ( _getterClass != null )
+        if ( getterClass != null )
         {
-            return _getterClass;
+            return getterClass;
         }
 
         return Double.TYPE;
@@ -80,7 +80,7 @@ public abstract class NumericExpression
 
             if ( value != null )
             {
-                _getterClass = value.getClass();
+                getterClass = value.getClass();
             }
 
             for ( int i = 0; i < _children.length; i++ )
@@ -116,12 +116,10 @@ public abstract class NumericExpression
         if ( context.getCurrentType() != null && !context.getCurrentType().isPrimitive()
             && context.getCurrentObject() != null && Number.class.isInstance( context.getCurrentObject() ) )
         {
-            ret = new StringBuilder( "((" )
-                .append( ExpressionCompiler.getCastString( context.getCurrentObject().getClass() ))
-                .append( ")" )
-                .append( ret )
-                .append( ")." )
-                .append( OgnlRuntime.getNumericValueGetter( context.getCurrentObject().getClass() ) );
+            ret = new StringBuilder( "((" ).append(
+                ExpressionCompiler.getCastString( context.getCurrentObject().getClass() ) ).append( ")" ).append(
+                ret ).append( ")." ).append(
+                OgnlRuntime.getNumericValueGetter( context.getCurrentObject().getClass() ) );
         }
         else if ( context.getCurrentType() != null && context.getCurrentType().isPrimitive()
             && ( ASTConst.class.isInstance( child ) || NumericExpression.class.isInstance( child ) ) )

Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectMethodAccessor.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectMethodAccessor.java?rev=1194866&r1=1194865&r2=1194866&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectMethodAccessor.java (original)
+++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectMethodAccessor.java Sat Oct 29 10:51:32 2011
@@ -37,7 +37,8 @@ public class ObjectMethodAccessor
     /**
      * {@inheritDoc}
      */
-    public Object callStaticMethod( Map<String, Object> context, Class<?> targetClass, String methodName, Object[] args )
+    public Object callStaticMethod( Map<String, Object> context, Class<?> targetClass, String methodName,
+                                    Object[] args )
         throws OgnlException
     {
         List<Method> methods = OgnlRuntime.getMethods( targetClass, methodName, true );

Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectPropertyAccessor.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectPropertyAccessor.java?rev=1194866&r1=1194865&r2=1194866&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectPropertyAccessor.java (original)
+++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/ObjectPropertyAccessor.java Sat Oct 29 10:51:32 2011
@@ -20,6 +20,7 @@ package org.apache.commons.ognl;
  */
 
 import org.apache.commons.ognl.enhance.ExpressionCompiler;
+import org.apache.commons.ognl.enhance.OgnlExpressionCompiler;
 import org.apache.commons.ognl.enhance.UnsupportedCompilationException;
 
 import java.beans.IntrospectionException;
@@ -49,7 +50,8 @@ public class ObjectPropertyAccessor
 
         try
         {
-            if ( ( result = OgnlRuntime.getMethodValue( ognlContext, target, name, true ) ) == OgnlRuntime.NotFound )
+            result = OgnlRuntime.getMethodValue( ognlContext, target, name, true );
+            if ( result == OgnlRuntime.NotFound )
             {
                 result = OgnlRuntime.getFieldValue( ognlContext, target, name, true );
             }
@@ -227,10 +229,11 @@ public class ObjectPropertyAccessor
             // try last ditch effort of checking if they were trying to do reflection via a return method value
 
             if ( m == null && context.getCurrentObject() != null )
+            {
                 m =
                     OgnlRuntime.getReadMethod( target.getClass(),
                                                context.getCurrentObject().toString().replaceAll( "\"", "" ) );
-
+            }
             // System.out.println("tried to get read method from target: " + target.getClass() + " with methodName:" +
             // methodName + " result: " + m);
             // try to get field if no method could be found
@@ -261,7 +264,8 @@ public class ObjectPropertyAccessor
             }
 
             context.setCurrentType( m.getReturnType() );
-            context.setCurrentAccessor( OgnlRuntime.getCompiler(context).getSuperOrInterfaceClass( m, m.getDeclaringClass() ) );
+            final OgnlExpressionCompiler compiler = OgnlRuntime.getCompiler( context );
+            context.setCurrentAccessor( compiler.getSuperOrInterfaceClass( m, m.getDeclaringClass() ) );
 
             return "." + m.getName() + "()";
 
@@ -288,52 +292,45 @@ public class ObjectPropertyAccessor
             }
 
             if ( m == null || m.getParameterTypes() == null || m.getParameterTypes().length <= 0 )
+            {
                 throw new UnsupportedCompilationException( "Unable to determine setting expression on "
                     + context.getCurrentObject() + " with index of " + index );
+            }
 
             Class<?> parm = m.getParameterTypes()[0];
             String conversion;
 
             if ( m.getParameterTypes().length > 1 )
+            {
                 throw new UnsupportedCompilationException(
-                                                           "Object property accessors can only support single parameter setters." );
+                    "Object property accessors can only support single parameter setters." );
+            }
 
+            final OgnlExpressionCompiler compiler = OgnlRuntime.getCompiler( context );
             if ( parm.isPrimitive() )
             {
                 Class<?> wrapClass = OgnlRuntime.getPrimitiveWrapperClass( parm );
-                conversion =
-                    OgnlRuntime.getCompiler( context ).createLocalReference( context,
-                                                                    "(("
-                                                                        + wrapClass.getName()
-                                                                        + ")org.apache.commons.ognl.OgnlOps#convertValue($3,"
-                                                                        + wrapClass.getName() + ".class, true))."
-                                                                        + OgnlRuntime.getNumericValueGetter( wrapClass ),
-                                                                    parm );
+                conversion = compiler.createLocalReference( context, "((" + wrapClass.getName()
+                    + ")org.apache.commons.ognl.OgnlOps#convertValue($3," + wrapClass.getName() + ".class, true))."
+                    + OgnlRuntime.getNumericValueGetter( wrapClass ), parm );
 
             }
             else if ( parm.isArray() )
             {
-                conversion =
-                    OgnlRuntime.getCompiler( context ).createLocalReference( context,
-                                                                    "("
-                                                                        + ExpressionCompiler.getCastString( parm )
-                                                                        + ")org.apache.commons.ognl.OgnlOps#toArray($3,"
-                                                                        + parm.getComponentType().getName() + ".class)",
-                                                                    parm );
+                conversion = compiler.createLocalReference( context, "(" + ExpressionCompiler.getCastString( parm )
+                    + ")org.apache.commons.ognl.OgnlOps#toArray($3," + parm.getComponentType().getName() + ".class)",
+                                                            parm );
 
             }
             else
             {
-                conversion =
-                    OgnlRuntime.getCompiler( context ).createLocalReference( context,
-                                                                    "("
-                                                                        + parm.getName()
-                                                                        + ")org.apache.commons.ognl.OgnlOps#convertValue($3,"
-                                                                        + parm.getName() + ".class)", parm );
+                conversion = compiler.createLocalReference( context, "(" + parm.getName()
+                    + ")org.apache.commons.ognl.OgnlOps#convertValue($3," + parm.getName() + ".class)", parm );
             }
 
             context.setCurrentType( m.getReturnType() );
-            context.setCurrentAccessor( OgnlRuntime.getCompiler( context ).getSuperOrInterfaceClass( m, m.getDeclaringClass() ) );
+            context.setCurrentAccessor(
+                compiler.getSuperOrInterfaceClass( m, m.getDeclaringClass() ) );
 
             return "." + m.getName() + "(" + conversion + ")";
 

Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/Ognl.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/Ognl.java?rev=1194866&r1=1194865&r2=1194866&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/Ognl.java (original)
+++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/Ognl.java Sat Oct 29 10:51:32 2011
@@ -126,13 +126,15 @@ public abstract class Ognl
     }
 
     /**
-     * Parses and compiles the given expression using the {@link org.apache.commons.ognl.enhance.OgnlExpressionCompiler} returned from
+     * Parses and compiles the given expression using the {@link org.apache.commons.ognl.enhance.OgnlExpressionCompiler}
+     * returned from
      * {@link org.apache.commons.ognl.OgnlRuntime#getCompiler(OgnlContext)}.
      * 
      * @param context The context to use.
      * @param root The root object for the given expression.
      * @param expression The expression to compile.
-     * @return The node with a compiled accessor set on {@link org.apache.commons.ognl.Node#getAccessor()} if compilation was successfull.
+     * @return The node with a compiled accessor set on {@link org.apache.commons.ognl.Node#getAccessor()} if
+     * compilation was successfull.
      *         In instances where compilation wasn't possible because of a partially null expression the
      *         {@link ExpressionAccessor} instance may be null and the compilation of this expression still possible at
      *         some as yet indertermined point in the future.
@@ -179,7 +181,8 @@ public abstract class Ognl
      * @param converter Converter used to convert return types of an expression in to their desired types.
      * @return a new Map with the keys <code>root</code> and <code>context</code> set appropriately
      */
-    public static Map<String, Object> createDefaultContext( Object root, ClassResolver classResolver, TypeConverter converter )
+    public static Map<String, Object> createDefaultContext( Object root, ClassResolver classResolver,
+                                                            TypeConverter converter )
     {
         return addDefaultContext( root, classResolver, converter, null, new OgnlContext() );
     }
@@ -194,8 +197,8 @@ public abstract class Ognl
      *            methods / fields.
      * @return a new Map with the keys <code>root</code> and <code>context</code> set appropriately
      */
-    public static Map<String, Object> createDefaultContext( Object root, ClassResolver classResolver, TypeConverter converter,
-                                            MemberAccess memberAccess )
+    public static Map<String, Object> createDefaultContext( Object root, ClassResolver classResolver,
+                                                            TypeConverter converter, MemberAccess memberAccess )
     {
         return addDefaultContext( root, classResolver, converter, memberAccess, new OgnlContext() );
     }
@@ -222,7 +225,8 @@ public abstract class Ognl
      * @param context The context to which OGNL context will be added.
      * @return Context Map with the keys <code>root</code> and <code>context</code> set appropriately
      */
-    public static Map<String, Object> addDefaultContext( Object root, ClassResolver classResolver, Map<String, Object> context )
+    public static Map<String, Object> addDefaultContext( Object root, ClassResolver classResolver,
+                                                         Map<String, Object> context )
     {
         return addDefaultContext( root, classResolver, null, null, context );
     }
@@ -237,7 +241,8 @@ public abstract class Ognl
      * @param context The context to which OGNL context will be added.
      * @return Context Map with the keys <code>root</code> and <code>context</code> set appropriately
      */
-    public static Map<String, Object> addDefaultContext( Object root, ClassResolver classResolver, TypeConverter converter, Map<String, Object> context )
+    public static Map<String, Object> addDefaultContext( Object root, ClassResolver classResolver,
+                                                         TypeConverter converter, Map<String, Object> context )
     {
         return addDefaultContext( root, classResolver, converter, null, context );
     }
@@ -254,8 +259,9 @@ public abstract class Ognl
      *            {@link OgnlContext} object.
      * @return Context Map with the keys <code>root</code> and <code>context</code> set appropriately
      */
-    public static Map<String, Object> addDefaultContext( Object root, ClassResolver classResolver, TypeConverter converter,
-                                         MemberAccess memberAccess, Map<String, Object> context )
+    public static Map<String, Object> addDefaultContext( Object root, ClassResolver classResolver,
+                                                         TypeConverter converter, MemberAccess memberAccess,
+                                                         Map<String, Object> context )
     {
         OgnlContext result;
 

Modified: commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlContext.java
URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlContext.java?rev=1194866&r1=1194865&r2=1194866&view=diff
==============================================================================
--- commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlContext.java (original)
+++ commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlContext.java Sat Oct 29 10:51:32 2011
@@ -59,9 +59,9 @@ public class OgnlContext
 
     private static final String PROPERTY_KEY_PREFIX = "ognl";
 
-    private static boolean DEFAULT_TRACE_EVALUATIONS = false;
+    private static boolean defaultTraceEvaluations = false;
 
-    private static boolean DEFAULT_KEEP_LAST_EVALUATION = false;
+    private static boolean defaultKeepLastEvaluation = false;
 
     public static final DefaultClassResolver DEFAULT_CLASS_RESOLVER = new DefaultClassResolver();
 
@@ -71,29 +71,29 @@ public class OgnlContext
 
     private static final Set<String> RESERVED_KEYS = new HashSet<String>( 11 );
 
-    private Object _root;
+    private Object root;
 
-    private Object _currentObject;
+    private Object currentObject;
 
-    private Node _currentNode;
+    private Node currentNode;
 
-    private boolean _traceEvaluations = DEFAULT_TRACE_EVALUATIONS;
+    private boolean traceEvaluations = defaultTraceEvaluations;
 
-    private Evaluation _rootEvaluation;
+    private Evaluation rootEvaluation;
 
-    private Evaluation _currentEvaluation;
+    private Evaluation currentEvaluation;
 
-    private Evaluation _lastEvaluation;
+    private Evaluation lastEvaluation;
 
-    private boolean _keepLastEvaluation = DEFAULT_KEEP_LAST_EVALUATION;
+    private boolean keepLastEvaluation = defaultKeepLastEvaluation;
 
-    private Map<String, Object> _values = new HashMap<String, Object>( 23 );
+    private Map<String, Object> values = new HashMap<String, Object>( 23 );
 
-    private ClassResolver _classResolver = DEFAULT_CLASS_RESOLVER;
+    private ClassResolver classResolver = DEFAULT_CLASS_RESOLVER;
 
-    private TypeConverter _typeConverter = DEFAULT_TYPE_CONVERTER;
+    private TypeConverter typeConverter = DEFAULT_TYPE_CONVERTER;
 
-    private MemberAccess _memberAccess = DEFAULT_MEMBER_ACCESS;
+    private MemberAccess memberAccess = DEFAULT_MEMBER_ACCESS;
 
     static
     {
@@ -113,11 +113,11 @@ public class OgnlContext
         {
             if ( ( s = System.getProperty( PROPERTY_KEY_PREFIX + ".traceEvaluations" ) ) != null )
             {
-                DEFAULT_TRACE_EVALUATIONS = Boolean.valueOf( s.trim() );
+                defaultTraceEvaluations = Boolean.valueOf( s.trim() );
             }
             if ( ( s = System.getProperty( PROPERTY_KEY_PREFIX + ".keepLastEvaluation" ) ) != null )
             {
-                DEFAULT_KEEP_LAST_EVALUATION = Boolean.valueOf( s.trim() );
+                defaultKeepLastEvaluation = Boolean.valueOf( s.trim() );
             }
         }
         catch ( SecurityException ex )
@@ -126,13 +126,13 @@ public class OgnlContext
         }
     }
 
-    private Stack<Class<?>> _typeStack = new Stack<Class<?>>();
+    private Stack<Class<?>> typeStack = new Stack<Class<?>>();
 
-    private Stack<Class<?>> _accessorStack = new Stack<Class<?>>();
+    private Stack<Class<?>> accessorStack = new Stack<Class<?>>();
 
-    private int _localReferenceCounter = 0;
+    private int localReferenceCounter = 0;
 
-    private Map<String, LocalReference> _localReferenceMap = null;
+    private Map<String, LocalReference> localReferenceMap = null;
 
     /**
      * Constructs a new OgnlContext with the default class resolver, type converter and member access.
@@ -150,39 +150,39 @@ public class OgnlContext
         this();
         if ( classResolver != null )
         {
-            this._classResolver = classResolver;
+            this.classResolver = classResolver;
         }
         if ( typeConverter != null )
         {
-            this._typeConverter = typeConverter;
+            this.typeConverter = typeConverter;
         }
         if ( memberAccess != null )
         {
-            this._memberAccess = memberAccess;
+            this.memberAccess = memberAccess;
         }
     }
 
     public OgnlContext( Map<String, Object> values )
     {
         super();
-        this._values = values;
+        this.values = values;
     }
 
     public OgnlContext( ClassResolver classResolver, TypeConverter typeConverter, MemberAccess memberAccess,
                         Map<String, Object> values )
     {
         this( classResolver, typeConverter, memberAccess );
-        this._values = values;
+        this.values = values;
     }
 
     public void setValues( Map<String, Object> value )
     {
-        _values.putAll( value );
+        values.putAll( value );
     }
 
     public Map<String, Object> getValues()
     {
-        return _values;
+        return values;
     }
 
     public void setClassResolver( ClassResolver value )
@@ -191,12 +191,12 @@ public class OgnlContext
         {
             throw new IllegalArgumentException( "cannot set ClassResolver to null" );
         }
-        _classResolver = value;
+        classResolver = value;
     }
 
     public ClassResolver getClassResolver()
     {
-        return _classResolver;
+        return classResolver;
     }
 
     public void setTypeConverter( TypeConverter value )
@@ -205,12 +205,12 @@ public class OgnlContext
         {
             throw new IllegalArgumentException( "cannot set TypeConverter to null" );
         }
-        _typeConverter = value;
+        typeConverter = value;
     }
 
     public TypeConverter getTypeConverter()
     {
-        return _typeConverter;
+        return typeConverter;
     }
 
     public void setMemberAccess( MemberAccess value )
@@ -219,50 +219,50 @@ public class OgnlContext
         {
             throw new IllegalArgumentException( "cannot set MemberAccess to null" );
         }
-        _memberAccess = value;
+        memberAccess = value;
     }
 
     public MemberAccess getMemberAccess()
     {
-        return _memberAccess;
+        return memberAccess;
     }
 
     public void setRoot( Object value )
     {
-        _root = value;
-        _accessorStack.clear();
-        _typeStack.clear();
-        _currentObject = value;
+        root = value;
+        accessorStack.clear();
+        typeStack.clear();
+        currentObject = value;
 
-        if ( _currentObject != null )
+        if ( currentObject != null )
         {
-            setCurrentType( _currentObject.getClass() );
+            setCurrentType( currentObject.getClass() );
         }
     }
 
     public Object getRoot()
     {
-        return _root;
+        return root;
     }
 
     public boolean getTraceEvaluations()
     {
-        return _traceEvaluations;
+        return traceEvaluations;
     }
 
     public void setTraceEvaluations( boolean value )
     {
-        _traceEvaluations = value;
+        traceEvaluations = value;
     }
 
     public Evaluation getLastEvaluation()
     {
-        return _lastEvaluation;
+        return lastEvaluation;
     }
 
     public void setLastEvaluation( Evaluation value )
     {
-        _lastEvaluation = value;
+        lastEvaluation = value;
     }
 
     /**
@@ -272,8 +272,8 @@ public class OgnlContext
      */
     public void recycleLastEvaluation()
     {
-        OgnlRuntime.getEvaluationPool().recycleAll( _lastEvaluation );
-        _lastEvaluation = null;
+        OgnlRuntime.getEvaluationPool().recycleAll( lastEvaluation );
+        lastEvaluation = null;
     }
 
     /**
@@ -282,7 +282,7 @@ public class OgnlContext
      */
     public boolean getKeepLastEvaluation()
     {
-        return _keepLastEvaluation;
+        return keepLastEvaluation;
     }
 
     /**
@@ -291,44 +291,44 @@ public class OgnlContext
      */
     public void setKeepLastEvaluation( boolean value )
     {
-        _keepLastEvaluation = value;
+        keepLastEvaluation = value;
     }
 
     public void setCurrentObject( Object value )
     {
-        _currentObject = value;
+        currentObject = value;
     }
 
     public Object getCurrentObject()
     {
-        return _currentObject;
+        return currentObject;
     }
 
     public void setCurrentAccessor( Class<?> type )
     {
-        _accessorStack.add( type );
+        accessorStack.add( type );
     }
 
     public Class<?> getCurrentAccessor()
     {
-        if ( _accessorStack.isEmpty() )
+        if ( accessorStack.isEmpty() )
         {
             return null;
         }
 
-        return _accessorStack.peek();
+        return accessorStack.peek();
     }
 
     public Class<?> getPreviousAccessor()
     {
-        if ( _accessorStack.isEmpty() )
+        if ( accessorStack.isEmpty() )
         {
             return null;
         }
 
-        if ( _accessorStack.size() > 1 )
+        if ( accessorStack.size() > 1 )
         {
-            return _accessorStack.get( _accessorStack.size() - 2 );
+            return accessorStack.get( accessorStack.size() - 2 );
         }
 
         return null;
@@ -336,12 +336,12 @@ public class OgnlContext
 
     public Class<?> getFirstAccessor()
     {
-        if ( _accessorStack.isEmpty() )
+        if ( accessorStack.isEmpty() )
         {
             return null;
         }
 
-        return _accessorStack.get( 0 );
+        return accessorStack.get( 0 );
     }
 
     /**
@@ -351,17 +351,17 @@ public class OgnlContext
      */
     public Class<?> getCurrentType()
     {
-        if ( _typeStack.isEmpty() )
+        if ( typeStack.isEmpty() )
         {
             return null;
         }
 
-        return _typeStack.peek();
+        return typeStack.peek();
     }
 
     public void setCurrentType( Class<?> type )
     {
-        _typeStack.add( type );
+        typeStack.add( type );
     }
 
     /**
@@ -372,14 +372,14 @@ public class OgnlContext
      */
     public Class<?> getPreviousType()
     {
-        if ( _typeStack.isEmpty() )
+        if ( typeStack.isEmpty() )
         {
             return null;
         }
 
-        if ( _typeStack.size() > 1 )
+        if ( typeStack.size() > 1 )
         {
-            return _typeStack.get( _typeStack.size() - 2 );
+            return typeStack.get( typeStack.size() - 2 );
         }
 
         return null;
@@ -387,32 +387,32 @@ public class OgnlContext
 
     public void setPreviousType( Class<?> type )
     {
-        if ( _typeStack.isEmpty() || _typeStack.size() < 2 )
+        if ( typeStack.isEmpty() || typeStack.size() < 2 )
         {
             return;
         }
 
-        _typeStack.set( _typeStack.size() - 2, type );
+        typeStack.set( typeStack.size() - 2, type );
     }
 
     public Class<?> getFirstType()
     {
-        if ( _typeStack.isEmpty() )
+        if ( typeStack.isEmpty() )
         {
             return null;
         }
 
-        return _typeStack.get( 0 );
+        return typeStack.get( 0 );
     }
 
     public void setCurrentNode( Node value )
     {
-        _currentNode = value;
+        currentNode = value;
     }
 
     public Node getCurrentNode()
     {
-        return _currentNode;
+        return currentNode;
     }
 
     /**
@@ -420,12 +420,12 @@ public class OgnlContext
      */
     public Evaluation getCurrentEvaluation()
     {
-        return _currentEvaluation;
+        return currentEvaluation;
     }
 
     public void setCurrentEvaluation( Evaluation value )
     {
-        _currentEvaluation = value;
+        currentEvaluation = value;
     }
 
     /**
@@ -434,12 +434,12 @@ public class OgnlContext
      */
     public Evaluation getRootEvaluation()
     {
-        return _rootEvaluation;
+        return rootEvaluation;
     }
 
     public void setRootEvaluation( Evaluation value )
     {
-        _rootEvaluation = value;
+        rootEvaluation = value;
     }
 
     /**
@@ -452,7 +452,7 @@ public class OgnlContext
 
         if ( relativeIndex <= 0 )
         {
-            result = _currentEvaluation;
+            result = currentEvaluation;
             while ( ( ++relativeIndex < 0 ) && ( result != null ) )
             {
                 result = result.getParent();
@@ -467,9 +467,9 @@ public class OgnlContext
      */
     public void pushEvaluation( Evaluation value )
     {
-        if ( _currentEvaluation != null )
+        if ( currentEvaluation != null )
         {
-            _currentEvaluation.addChild( value );
+            currentEvaluation.addChild( value );
         }
         else
         {
@@ -485,9 +485,9 @@ public class OgnlContext
     {
         Evaluation result;
 
-        result = _currentEvaluation;
+        result = currentEvaluation;
         setCurrentEvaluation( result.getParent() );
-        if ( _currentEvaluation == null )
+        if ( currentEvaluation == null )
         {
             setLastEvaluation( getKeepLastEvaluation() ? result : null );
             setRootEvaluation( null );
@@ -498,43 +498,43 @@ public class OgnlContext
 
     public int incrementLocalReferenceCounter()
     {
-        return ++_localReferenceCounter;
+        return ++localReferenceCounter;
     }
 
     public void addLocalReference( String key, LocalReference reference )
     {
-        if ( _localReferenceMap == null )
+        if ( localReferenceMap == null )
         {
-            _localReferenceMap = new LinkedHashMap<String, LocalReference>();
+            localReferenceMap = new LinkedHashMap<String, LocalReference>();
         }
 
-        _localReferenceMap.put( key, reference );
+        localReferenceMap.put( key, reference );
     }
 
     public Map<String, LocalReference> getLocalReferences()
     {
-        return _localReferenceMap;
+        return localReferenceMap;
     }
 
     /* ================= Map interface ================= */
     public int size()
     {
-        return _values.size();
+        return values.size();
     }
 
     public boolean isEmpty()
     {
-        return _values.isEmpty();
+        return values.isEmpty();
     }
 
     public boolean containsKey( Object key )
     {
-        return _values.containsKey( key );
+        return values.containsKey( key );
     }
 
     public boolean containsValue( Object value )
     {
-        return _values.containsValue( value );
+        return values.containsValue( value );
     }
 
     public Object get( Object key )
@@ -583,7 +583,7 @@ public class OgnlContext
         }
         else
         {
-            result = _values.get( key );
+            result = values.get( key );
         }
         return result;
     }
@@ -618,7 +618,7 @@ public class OgnlContext
             else if ( LAST_EVALUATION_CONTEXT_KEY.equals( key ) )
             {
                 result = getLastEvaluation();
-                _lastEvaluation = (Evaluation) value;
+                lastEvaluation = (Evaluation) value;
             }
             else if ( KEEP_LAST_EVALUATION_CONTEXT_KEY.equals( key ) )
             {
@@ -643,7 +643,7 @@ public class OgnlContext
         }
         else
         {
-            result = _values.put( key, value );
+            result = values.put( key, value );
         }
 
         return result;
@@ -674,7 +674,7 @@ public class OgnlContext
             }
             else if ( LAST_EVALUATION_CONTEXT_KEY.equals( key ) )
             {
-                result = _lastEvaluation;
+                result = lastEvaluation;
                 setLastEvaluation( null );
             }
             else if ( CLASS_RESOLVER_CONTEXT_KEY.equals( key ) )
@@ -695,7 +695,7 @@ public class OgnlContext
         }
         else
         {
-            result = _values.remove( key );
+            result = values.remove( key );
         }
         return result;
     }
@@ -710,14 +710,14 @@ public class OgnlContext
 
     public void clear()
     {
-        _values.clear();
-        _typeStack.clear();
-        _accessorStack.clear();
+        values.clear();
+        typeStack.clear();
+        accessorStack.clear();
 
-        _localReferenceCounter = 0;
-        if ( _localReferenceMap != null )
+        localReferenceCounter = 0;
+        if ( localReferenceMap != null )
         {
-            _localReferenceMap.clear();
+            localReferenceMap.clear();
         }
 
         setRoot( null );
@@ -734,30 +734,30 @@ public class OgnlContext
     public Set<String> keySet()
     {
         /* Should root, currentObject, classResolver, typeConverter & memberAccess be included here? */
-        return _values.keySet();
+        return values.keySet();
     }
 
     public Collection<Object> values()
     {
         /* Should root, currentObject, classResolver, typeConverter & memberAccess be included here? */
-        return _values.values();
+        return values.values();
     }
 
     public Set<Entry<String, Object>> entrySet()
     {
         /* Should root, currentObject, classResolver, typeConverter & memberAccess be included here? */
-        return _values.entrySet();
+        return values.entrySet();
     }
 
     @Override
     public boolean equals( Object o )
     {
-        return _values.equals( o );
+        return values.equals( o );
     }
 
     @Override
     public int hashCode()
     {
-        return _values.hashCode();
+        return values.hashCode();
     }
 }



Mime
View raw message