You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2011/05/14 15:18:36 UTC
svn commit: r1103095 [5/24] - in /incubator/ognl/trunk/src:
main/java/org/apache/commons/ognl/ main/java/org/apache/commons/ognl/enhance/
main/java/org/apache/commons/ognl/internal/
test/java/org/apache/commons/ognl/ test/java/org/apache/commons/ognl/t...
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTStaticMethod.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTStaticMethod.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTStaticMethod.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTStaticMethod.java Sat May 14 13:18:29 2011
@@ -28,44 +28,50 @@ import java.lang.reflect.Method;
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-public class ASTStaticMethod extends SimpleNode implements NodeType
+public class ASTStaticMethod
+ extends SimpleNode
+ implements NodeType
{
private String _className;
+
private String _methodName;
private Class _getterClass;
- public ASTStaticMethod(int id)
+ public ASTStaticMethod( int id )
{
- super(id);
+ super( id );
}
- public ASTStaticMethod(OgnlParser p, int id)
+ public ASTStaticMethod( OgnlParser p, int id )
{
- super(p, id);
+ super( p, id );
}
/** Called from parser action. */
- void init(String className, String methodName)
+ void init( String className, String methodName )
{
_className = className;
_methodName = methodName;
}
- protected Object getValueBody(OgnlContext context, Object source)
- throws OgnlException
+ protected Object getValueBody( OgnlContext context, Object source )
+ throws OgnlException
{
- Object[] args = OgnlRuntime.getObjectArrayPool().create(jjtGetNumChildren());
+ Object[] args = OgnlRuntime.getObjectArrayPool().create( jjtGetNumChildren() );
Object root = context.getRoot();
- try {
- for(int i = 0, icount = args.length; i < icount; ++i)
- args[i] = _children[i].getValue(context, root);
-
- return OgnlRuntime.callStaticMethod(context, _className, _methodName, args);
- } finally {
- OgnlRuntime.getObjectArrayPool().recycle(args);
+ try
+ {
+ for ( int i = 0, icount = args.length; i < icount; ++i )
+ args[i] = _children[i].getValue( context, root );
+
+ return OgnlRuntime.callStaticMethod( context, _className, _methodName, args );
+ }
+ finally
+ {
+ OgnlRuntime.getObjectArrayPool().recycle( args );
}
}
@@ -81,119 +87,139 @@ public class ASTStaticMethod extends Sim
public String toString()
{
- StringBuilder result = new StringBuilder("@").append(_className).append("@").append(_methodName);
+ StringBuilder result = new StringBuilder( "@" ).append( _className ).append( "@" ).append( _methodName );
- result.append("(");
- if ((_children != null) && (_children.length > 0)) {
- for(int i = 0; i < _children.length; i++) {
- if (i > 0) {
- result.append(", ");
+ result.append( "(" );
+ if ( ( _children != null ) && ( _children.length > 0 ) )
+ {
+ for ( int i = 0; i < _children.length; i++ )
+ {
+ if ( i > 0 )
+ {
+ result.append( ", " );
}
- result.append(_children[i]);
+ result.append( _children[i] );
}
}
- result.append(")");
+ result.append( ")" );
return result.toString();
}
- public String toGetSourceString(OgnlContext context, Object target)
+ public String toGetSourceString( OgnlContext context, Object target )
{
String result = _className + "#" + _methodName + "(";
- try {
- Class clazz = OgnlRuntime.classForName(context, _className);
- Method m = OgnlRuntime.getMethod(context, clazz, _methodName, _children, true);
+ try
+ {
+ Class clazz = OgnlRuntime.classForName( context, _className );
+ Method m = OgnlRuntime.getMethod( context, clazz, _methodName, _children, true );
- if (clazz == null || m == null)
- throw new UnsupportedCompilationException("Unable to find class/method combo " + _className + " / " + _methodName);
+ if ( clazz == null || m == null )
+ throw new UnsupportedCompilationException( "Unable to find class/method combo " + _className + " / "
+ + _methodName );
- if (!context.getMemberAccess().isAccessible(context, clazz, m, _methodName))
+ if ( !context.getMemberAccess().isAccessible( context, clazz, m, _methodName ) )
{
- throw new UnsupportedCompilationException("Method is not accessible, check your jvm runtime security settings. " +
- "For static class method " + _className + " / " + _methodName);
+ throw new UnsupportedCompilationException(
+ "Method is not accessible, check your jvm runtime security settings. "
+ + "For static class method " + _className + " / "
+ + _methodName );
}
- if ((_children != null) && (_children.length > 0))
+ if ( ( _children != null ) && ( _children.length > 0 ) )
{
Class[] parms = m.getParameterTypes();
- for(int i = 0; i < _children.length; i++)
+ for ( int i = 0; i < _children.length; i++ )
{
- if (i > 0)
+ if ( i > 0 )
{
result = result + ", ";
}
Class prevType = context.getCurrentType();
- Object value = _children[i].getValue(context, context.getRoot());
- String parmString = _children[i].toGetSourceString(context, context.getRoot());
+ Object value = _children[i].getValue( context, context.getRoot() );
+ String parmString = _children[i].toGetSourceString( context, context.getRoot() );
- if (parmString == null || parmString.trim().length() < 1)
+ if ( parmString == null || parmString.trim().length() < 1 )
parmString = "null";
// to undo type setting of constants when used as method parameters
- if (ASTConst.class.isInstance(_children[i]))
+ if ( ASTConst.class.isInstance( _children[i] ) )
{
- context.setCurrentType(prevType);
+ context.setCurrentType( prevType );
}
- parmString = ExpressionCompiler.getRootExpression(_children[i], context.getRoot(), context) + parmString;
+ parmString =
+ ExpressionCompiler.getRootExpression( _children[i], context.getRoot(), context ) + parmString;
String cast = "";
- if (ExpressionCompiler.shouldCast(_children[i]))
+ if ( ExpressionCompiler.shouldCast( _children[i] ) )
{
- cast = (String)context.remove(ExpressionCompiler.PRE_CAST);
+ cast = (String) context.remove( ExpressionCompiler.PRE_CAST );
}
- if (cast == null)
+ if ( cast == null )
cast = "";
- if (!ASTConst.class.isInstance(_children[i]))
+ if ( !ASTConst.class.isInstance( _children[i] ) )
parmString = cast + parmString;
Class valueClass = value != null ? value.getClass() : null;
- if (NodeType.class.isAssignableFrom(_children[i].getClass()))
- valueClass = ((NodeType)_children[i]).getGetterClass();
+ if ( NodeType.class.isAssignableFrom( _children[i].getClass() ) )
+ valueClass = ( (NodeType) _children[i] ).getGetterClass();
- if (valueClass != parms[i])
+ if ( valueClass != parms[i] )
{
- if (parms[i].isArray())
+ if ( parms[i].isArray() )
{
- parmString = OgnlRuntime.getCompiler()
- .createLocalReference(context,
- "(" + ExpressionCompiler.getCastString(parms[i])
- + ")org.apache.commons.ognl.OgnlOps.toArray(" + parmString + ", " + parms[i].getComponentType().getName()
- + ".class, true)",
- parms[i]
- );
+ parmString =
+ OgnlRuntime.getCompiler().createLocalReference( context,
+ "("
+ + ExpressionCompiler.getCastString( parms[i] )
+ + ")org.apache.commons.ognl.OgnlOps.toArray("
+ + parmString
+ + ", "
+ + parms[i].getComponentType().getName()
+ + ".class, true)", parms[i] );
- } else if (parms[i].isPrimitive())
+ }
+ else if ( parms[i].isPrimitive() )
{
- Class wrapClass = OgnlRuntime.getPrimitiveWrapperClass(parms[i]);
+ Class wrapClass = OgnlRuntime.getPrimitiveWrapperClass( parms[i] );
- parmString = OgnlRuntime.getCompiler().createLocalReference(context,
- "((" + wrapClass.getName()
- + ")org.apache.commons.ognl.OgnlOps.convertValue(" + parmString + ","
- + wrapClass.getName() + ".class, true))."
- + OgnlRuntime.getNumericValueGetter(wrapClass),
- parms[i]
- );
+ parmString =
+ OgnlRuntime.getCompiler().createLocalReference( context,
+ "(("
+ + wrapClass.getName()
+ + ")org.apache.commons.ognl.OgnlOps.convertValue("
+ + parmString
+ + ","
+ + wrapClass.getName()
+ + ".class, true))."
+ + OgnlRuntime.getNumericValueGetter( wrapClass ),
+ parms[i] );
- } else if (parms[i] != Object.class)
+ }
+ else if ( parms[i] != Object.class )
{
- parmString = OgnlRuntime.getCompiler()
- .createLocalReference(context,
- "(" + parms[i].getName() + ")org.apache.commons.ognl.OgnlOps.convertValue(" + parmString + "," + parms[i].getName() + ".class)",
- parms[i]
- );
- } else if ((NodeType.class.isInstance(_children[i])
- && ((NodeType)_children[i]).getGetterClass() != null
- && Number.class.isAssignableFrom(((NodeType)_children[i]).getGetterClass()))
- || valueClass.isPrimitive())
+ parmString =
+ OgnlRuntime.getCompiler().createLocalReference( context,
+ "("
+ + parms[i].getName()
+ + ")org.apache.commons.ognl.OgnlOps.convertValue("
+ + parmString + ","
+ + parms[i].getName() + ".class)",
+ parms[i] );
+ }
+ else if ( ( NodeType.class.isInstance( _children[i] )
+ && ( (NodeType) _children[i] ).getGetterClass() != null && Number.class.isAssignableFrom( ( (NodeType) _children[i] ).getGetterClass() ) )
+ || valueClass.isPrimitive() )
{
parmString = " ($w) " + parmString;
- } else if (valueClass.isPrimitive())
+ }
+ else if ( valueClass.isPrimitive() )
{
parmString = "($w) " + parmString;
}
@@ -207,31 +233,34 @@ public class ASTStaticMethod extends Sim
try
{
- Object contextObj = getValueBody(context, target);
- context.setCurrentObject(contextObj);
- } catch (Throwable t)
+ Object contextObj = getValueBody( context, target );
+ context.setCurrentObject( contextObj );
+ }
+ catch ( Throwable t )
{
// ignore
}
- if (m != null)
+ if ( m != null )
{
_getterClass = m.getReturnType();
- context.setCurrentType(m.getReturnType());
- context.setCurrentAccessor(OgnlRuntime.getCompiler().getSuperOrInterfaceClass(m, m.getDeclaringClass()));
+ context.setCurrentType( m.getReturnType() );
+ context.setCurrentAccessor( OgnlRuntime.getCompiler().getSuperOrInterfaceClass( m,
+ m.getDeclaringClass() ) );
}
- } catch (Throwable t)
+ }
+ catch ( Throwable t )
{
- throw OgnlOps.castToRuntime(t);
+ throw OgnlOps.castToRuntime( t );
}
return result;
}
- public String toSetSourceString(OgnlContext context, Object target)
+ public String toSetSourceString( OgnlContext context, Object target )
{
- return toGetSourceString(context, target);
+ return toGetSourceString( context, target );
}
}
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSubtract.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSubtract.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSubtract.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTSubtract.java Sat May 14 13:18:29 2011
@@ -23,24 +23,28 @@ package org.apache.commons.ognl;
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-class ASTSubtract extends NumericExpression
+class ASTSubtract
+ extends NumericExpression
{
- public ASTSubtract(int id) {
- super(id);
+ public ASTSubtract( int id )
+ {
+ super( id );
}
- public ASTSubtract(OgnlParser p, int id) {
- super(p, id);
+ public ASTSubtract( OgnlParser p, int id )
+ {
+ super( p, id );
}
- protected Object getValueBody( OgnlContext context, Object source ) throws OgnlException
+ protected Object getValueBody( OgnlContext context, Object source )
+ throws OgnlException
{
Object v1 = _children[0].getValue( context, source );
Object v2 = _children[1].getValue( context, source );
return OgnlOps.subtract( v1, v2 );
}
- public String getExpressionOperator(int index)
+ public String getExpressionOperator( int index )
{
return "-";
}
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTTest.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTTest.java Sat May 14 13:18:29 2011
@@ -25,101 +25,112 @@ import org.apache.commons.ognl.enhance.U
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-class ASTTest extends ExpressionNode
+class ASTTest
+ extends ExpressionNode
{
- public ASTTest(int id) {
- super(id);
+ public ASTTest( int id )
+ {
+ super( id );
}
- public ASTTest(OgnlParser p, int id) {
- super(p, id);
+ public ASTTest( OgnlParser p, int id )
+ {
+ super( p, id );
}
- protected Object getValueBody( OgnlContext context, Object source ) throws OgnlException
+ protected Object getValueBody( OgnlContext context, Object source )
+ throws OgnlException
{
Object test = _children[0].getValue( context, source );
- int branch = OgnlOps.booleanValue(test)? 1 : 2;
+ int branch = OgnlOps.booleanValue( test ) ? 1 : 2;
return _children[branch].getValue( context, source );
}
- protected void setValueBody( OgnlContext context, Object target, Object value ) throws OgnlException
+ protected void setValueBody( OgnlContext context, Object target, Object value )
+ throws OgnlException
{
Object test = _children[0].getValue( context, target );
- int branch = OgnlOps.booleanValue(test)? 1 : 2;
+ int branch = OgnlOps.booleanValue( test ) ? 1 : 2;
_children[branch].setValue( context, target, value );
}
- public String getExpressionOperator(int index)
+ public String getExpressionOperator( int index )
{
- return (index == 1) ? "?" : ":";
+ return ( index == 1 ) ? "?" : ":";
}
-
- public String toGetSourceString(OgnlContext context, Object target)
+
+ public String toGetSourceString( OgnlContext context, Object target )
{
- if (target == null)
- throw new UnsupportedCompilationException("evaluation resulted in null expression.");
+ if ( target == null )
+ throw new UnsupportedCompilationException( "evaluation resulted in null expression." );
- if (_children.length != 3)
- throw new UnsupportedCompilationException("Can only compile test expressions with two children." + _children.length);
+ if ( _children.length != 3 )
+ throw new UnsupportedCompilationException( "Can only compile test expressions with two children."
+ + _children.length );
String result = "";
-
- try {
- String first = OgnlRuntime.getChildSource(context, target, _children[0]);
- if (!OgnlRuntime.isBoolean(first) && !context.getCurrentType().isPrimitive())
- first = OgnlRuntime.getCompiler().createLocalReference(context, first, context.getCurrentType());
-
- if (ExpressionNode.class.isInstance(_children[0]))
+ try
+ {
+
+ String first = OgnlRuntime.getChildSource( context, target, _children[0] );
+ if ( !OgnlRuntime.isBoolean( first ) && !context.getCurrentType().isPrimitive() )
+ first = OgnlRuntime.getCompiler().createLocalReference( context, first, context.getCurrentType() );
+
+ if ( ExpressionNode.class.isInstance( _children[0] ) )
{
first = "(" + first + ")";
}
-
- String second = OgnlRuntime.getChildSource(context, target, _children[1]);
+
+ String second = OgnlRuntime.getChildSource( context, target, _children[1] );
Class secondType = context.getCurrentType();
- if (!OgnlRuntime.isBoolean(second) && !context.getCurrentType().isPrimitive())
- second = OgnlRuntime.getCompiler().createLocalReference(context, second, context.getCurrentType());
+ if ( !OgnlRuntime.isBoolean( second ) && !context.getCurrentType().isPrimitive() )
+ second = OgnlRuntime.getCompiler().createLocalReference( context, second, context.getCurrentType() );
- if (ExpressionNode.class.isInstance(_children[1]))
+ if ( ExpressionNode.class.isInstance( _children[1] ) )
{
second = "(" + second + ")";
}
- String third = OgnlRuntime.getChildSource(context, target, _children[2]);
+ String third = OgnlRuntime.getChildSource( context, target, _children[2] );
Class thirdType = context.getCurrentType();
-
- if (!OgnlRuntime.isBoolean(third) && !context.getCurrentType().isPrimitive())
- third = OgnlRuntime.getCompiler().createLocalReference(context, third, context.getCurrentType());
- if (ExpressionNode.class.isInstance(_children[2]))
+
+ if ( !OgnlRuntime.isBoolean( third ) && !context.getCurrentType().isPrimitive() )
+ third = OgnlRuntime.getCompiler().createLocalReference( context, third, context.getCurrentType() );
+ if ( ExpressionNode.class.isInstance( _children[2] ) )
{
third = "(" + third + ")";
}
- boolean mismatched = (secondType.isPrimitive() && !thirdType.isPrimitive())
- || (!secondType.isPrimitive() && thirdType.isPrimitive()) ? true : false;
+ boolean mismatched =
+ ( secondType.isPrimitive() && !thirdType.isPrimitive() )
+ || ( !secondType.isPrimitive() && thirdType.isPrimitive() ) ? true : false;
result += "org.apache.commons.ognl.OgnlOps.booleanValue(" + first + ")";
result += " ? ";
- result += (mismatched ? " ($w) " : "") + second;
+ result += ( mismatched ? " ($w) " : "" ) + second;
result += " : ";
- result += (mismatched ? " ($w) " : "") + third;
+ result += ( mismatched ? " ($w) " : "" ) + third;
- context.setCurrentObject(target);
- context.setCurrentType(mismatched ? Object.class : secondType);
+ context.setCurrentObject( target );
+ context.setCurrentType( mismatched ? Object.class : secondType );
return result;
-
- } catch (NullPointerException e) {
-
+
+ }
+ catch ( NullPointerException e )
+ {
+
// expected to happen in some instances
- throw new UnsupportedCompilationException("evaluation resulted in null expression.");
- } catch (Throwable t)
+ throw new UnsupportedCompilationException( "evaluation resulted in null expression." );
+ }
+ catch ( Throwable t )
{
- throw OgnlOps.castToRuntime(t);
+ throw OgnlOps.castToRuntime( t );
}
}
}
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTThisVarRef.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTThisVarRef.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTThisVarRef.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTThisVarRef.java Sat May 14 13:18:29 2011
@@ -25,43 +25,44 @@ import org.apache.commons.ognl.enhance.U
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-public class ASTThisVarRef extends ASTVarRef
+public class ASTThisVarRef
+ extends ASTVarRef
{
- public ASTThisVarRef(int id)
+ public ASTThisVarRef( int id )
{
- super(id);
+ super( id );
}
- public ASTThisVarRef(OgnlParser p, int id)
+ public ASTThisVarRef( OgnlParser p, int id )
{
- super(p, id);
+ super( p, id );
}
- protected Object getValueBody(OgnlContext context, Object source)
+ protected Object getValueBody( OgnlContext context, Object source )
throws OgnlException
{
return context.getCurrentObject();
}
- protected void setValueBody(OgnlContext context, Object target, Object value)
+ protected void setValueBody( OgnlContext context, Object target, Object value )
throws OgnlException
{
- context.setCurrentObject(value);
+ context.setCurrentObject( value );
}
public String toString()
{
return "#this";
}
-
- public String toGetSourceString(OgnlContext context, Object target)
+
+ public String toGetSourceString( OgnlContext context, Object target )
{
- throw new UnsupportedCompilationException("Unable to compile this references.");
+ throw new UnsupportedCompilationException( "Unable to compile this references." );
}
-
- public String toSetSourceString(OgnlContext context, Object target)
+
+ public String toSetSourceString( OgnlContext context, Object target )
{
- throw new UnsupportedCompilationException("Unable to compile this references.");
+ throw new UnsupportedCompilationException( "Unable to compile this references." );
}
}
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTUnsignedShiftRight.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTUnsignedShiftRight.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTUnsignedShiftRight.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTUnsignedShiftRight.java Sat May 14 13:18:29 2011
@@ -23,44 +23,49 @@ package org.apache.commons.ognl;
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-class ASTUnsignedShiftRight extends NumericExpression
+class ASTUnsignedShiftRight
+ extends NumericExpression
{
- public ASTUnsignedShiftRight(int id) {
- super(id);
+ public ASTUnsignedShiftRight( int id )
+ {
+ super( id );
}
- public ASTUnsignedShiftRight(OgnlParser p, int id) {
- super(p, id);
+ public ASTUnsignedShiftRight( OgnlParser p, int id )
+ {
+ super( p, id );
}
- protected Object getValueBody( OgnlContext context, Object source ) throws OgnlException
+ protected Object getValueBody( OgnlContext context, Object source )
+ throws OgnlException
{
Object v1 = _children[0].getValue( context, source );
Object v2 = _children[1].getValue( context, source );
return OgnlOps.unsignedShiftRight( v1, v2 );
}
- public String getExpressionOperator(int index)
+ public String getExpressionOperator( int index )
{
return ">>>";
}
- public String toGetSourceString(OgnlContext context, Object target)
+ public String toGetSourceString( OgnlContext context, Object target )
{
String result = "";
- try {
+ try
+ {
- String child1 = OgnlRuntime.getChildSource(context, target, _children[0]);
- child1 = coerceToNumeric(child1, context, _children[0]);
+ String child1 = OgnlRuntime.getChildSource( context, target, _children[0] );
+ child1 = coerceToNumeric( child1, context, _children[0] );
- String child2 = OgnlRuntime.getChildSource(context, target, _children[1]);
- child2 = coerceToNumeric(child2, context, _children[1]);
-
- Object v1 = _children[0].getValue(context, target);
- int type = OgnlOps.getNumericType(v1);
+ String child2 = OgnlRuntime.getChildSource( context, target, _children[1] );
+ child2 = coerceToNumeric( child2, context, _children[1] );
- if (type <= OgnlOps.INT)
+ Object v1 = _children[0].getValue( context, target );
+ int type = OgnlOps.getNumericType( v1 );
+
+ if ( type <= OgnlOps.INT )
{
child1 = "(int)" + child1;
child2 = "(int)" + child2;
@@ -68,12 +73,13 @@ class ASTUnsignedShiftRight extends Nume
result = child1 + " >>> " + child2;
- context.setCurrentType(Integer.TYPE);
- context.setCurrentObject(getValueBody(context, target));
+ context.setCurrentType( Integer.TYPE );
+ context.setCurrentObject( getValueBody( context, target ) );
- } catch (Throwable t)
+ }
+ catch ( Throwable t )
{
- throw OgnlOps.castToRuntime(t);
+ throw OgnlOps.castToRuntime( t );
}
return result;
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTVarRef.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTVarRef.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTVarRef.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTVarRef.java Sat May 14 13:18:29 2011
@@ -22,52 +22,55 @@ package org.apache.commons.ognl;
import org.apache.commons.ognl.enhance.OrderedReturn;
import org.apache.commons.ognl.enhance.UnsupportedCompilationException;
-
/**
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-public class ASTVarRef extends SimpleNode implements NodeType, OrderedReturn {
-
+public class ASTVarRef
+ extends SimpleNode
+ implements NodeType, OrderedReturn
+{
+
private String _name;
-
+
protected Class _getterClass;
protected String _core;
+
protected String _last;
- public ASTVarRef(int id)
+ public ASTVarRef( int id )
{
- super(id);
+ super( id );
}
-
- public ASTVarRef(OgnlParser p, int id)
+
+ public ASTVarRef( OgnlParser p, int id )
{
- super(p, id);
+ super( p, id );
}
- void setName(String name)
+ void setName( String name )
{
this._name = name;
}
-
- protected Object getValueBody(OgnlContext context, Object source)
+
+ protected Object getValueBody( OgnlContext context, Object source )
throws OgnlException
{
- return context.get(_name);
+ return context.get( _name );
}
- protected void setValueBody(OgnlContext context, Object target, Object value)
+ protected void setValueBody( OgnlContext context, Object target, Object value )
throws OgnlException
{
- context.put(_name, value);
+ context.put( _name, value );
}
-
+
public Class getGetterClass()
{
return _getterClass;
}
-
+
public Class getSetterClass()
{
return null;
@@ -87,44 +90,47 @@ public class ASTVarRef extends SimpleNod
{
return "#" + _name;
}
-
- public String toGetSourceString(OgnlContext context, Object target)
+
+ public String toGetSourceString( OgnlContext context, Object target )
{
- Object value = context.get(_name);
+ Object value = context.get( _name );
+
+ if ( value != null )
+ {
- if (value != null) {
-
_getterClass = value.getClass();
}
- context.setCurrentType(_getterClass);
- context.setCurrentAccessor(context.getClass());
-
- context.setCurrentObject(value);
- //context.setRoot(context.get(_name));
-
- if (context.getCurrentObject() == null)
- throw new UnsupportedCompilationException("Current context object is null, can't compile var reference.");
+ context.setCurrentType( _getterClass );
+ context.setCurrentAccessor( context.getClass() );
+
+ context.setCurrentObject( value );
+ // context.setRoot(context.get(_name));
+
+ if ( context.getCurrentObject() == null )
+ throw new UnsupportedCompilationException( "Current context object is null, can't compile var reference." );
String pre = "";
String post = "";
- if (context.getCurrentType() != null) {
- pre = "((" + OgnlRuntime.getCompiler().getInterfaceClass(context.getCurrentType()).getName() + ")";
+ if ( context.getCurrentType() != null )
+ {
+ pre = "((" + OgnlRuntime.getCompiler().getInterfaceClass( context.getCurrentType() ).getName() + ")";
post = ")";
}
-
- if (_parent != null && ASTAssign.class.isInstance(_parent)) {
+
+ if ( _parent != null && ASTAssign.class.isInstance( _parent ) )
+ {
_core = "$1.put(\"" + _name + "\",";
_last = pre + "$1.get(\"" + _name + "\")" + post;
-
+
return _core;
}
return pre + "$1.get(\"" + _name + "\")" + post;
}
-
- public String toSetSourceString(OgnlContext context, Object target)
+
+ public String toSetSourceString( OgnlContext context, Object target )
{
- return toGetSourceString(context, target);
+ return toGetSourceString( context, target );
}
}
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTXor.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTXor.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTXor.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ASTXor.java Sat May 14 13:18:29 2011
@@ -23,29 +23,34 @@ package org.apache.commons.ognl;
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-class ASTXor extends NumericExpression
+class ASTXor
+ extends NumericExpression
{
- public ASTXor(int id) {
- super(id);
+ public ASTXor( int id )
+ {
+ super( id );
}
- public ASTXor(OgnlParser p, int id) {
- super(p, id);
+ public ASTXor( OgnlParser p, int id )
+ {
+ super( p, id );
}
- public void jjtClose() {
+ public void jjtClose()
+ {
flattenTree();
}
- protected Object getValueBody( OgnlContext context, Object source ) throws OgnlException
+ protected Object getValueBody( OgnlContext context, Object source )
+ throws OgnlException
{
Object result = _children[0].getValue( context, source );
- for ( int i=1; i < _children.length; ++i )
- result = OgnlOps.binaryXor( result, _children[i].getValue(context, source) );
+ for ( int i = 1; i < _children.length; ++i )
+ result = OgnlOps.binaryXor( result, _children[i].getValue( context, source ) );
return result;
}
- public String getExpressionOperator(int index)
+ public String getExpressionOperator( int index )
{
return "^";
}
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ArrayElementsAccessor.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ArrayElementsAccessor.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ArrayElementsAccessor.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ArrayElementsAccessor.java Sat May 14 13:18:29 2011
@@ -24,15 +24,19 @@ import java.util.Enumeration;
/**
* Implementation of ElementsAccessor that returns an iterator over a Java array.
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-public class ArrayElementsAccessor implements ElementsAccessor
+public class ArrayElementsAccessor
+ implements ElementsAccessor
{
public Enumeration getElements( final Object target )
{
- return new Enumeration() {
+ return new Enumeration()
+ {
private int count = Array.getLength( target );
+
private int index = 0;
public boolean hasMoreElements()
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ArrayPropertyAccessor.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ArrayPropertyAccessor.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ArrayPropertyAccessor.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ArrayPropertyAccessor.java Sat May 14 13:18:29 2011
@@ -23,183 +23,199 @@ import java.lang.reflect.Array;
import java.util.Map;
/**
- * Implementation of PropertyAccessor that uses numbers and dynamic subscripts as properties to
- * index into Java arrays.
- *
+ * Implementation of PropertyAccessor that uses numbers and dynamic subscripts as properties to index into Java arrays.
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-public class ArrayPropertyAccessor extends ObjectPropertyAccessor implements PropertyAccessor
+public class ArrayPropertyAccessor
+ extends ObjectPropertyAccessor
+ implements PropertyAccessor
{
- public Object getProperty(Map context, Object target, Object name)
- throws OgnlException
+ public Object getProperty( Map context, Object target, Object name )
+ throws OgnlException
{
Object result = null;
- if (name instanceof String)
+ if ( name instanceof String )
{
- if (name.equals("length"))
+ if ( name.equals( "length" ) )
{
- result = new Integer(Array.getLength(target));
- } else
+ result = new Integer( Array.getLength( target ) );
+ }
+ else
{
- result = super.getProperty(context, target, name);
+ result = super.getProperty( context, target, name );
}
- } else
+ }
+ else
{
Object index = name;
- if (index instanceof DynamicSubscript)
+ if ( index instanceof DynamicSubscript )
{
- int len = Array.getLength(target);
+ int len = Array.getLength( target );
- switch(((DynamicSubscript) index).getFlag())
+ switch ( ( (DynamicSubscript) index ).getFlag() )
{
case DynamicSubscript.ALL:
- result = Array.newInstance(target.getClass().getComponentType(), len);
- System.arraycopy(target, 0, result, 0, len);
+ result = Array.newInstance( target.getClass().getComponentType(), len );
+ System.arraycopy( target, 0, result, 0, len );
break;
case DynamicSubscript.FIRST:
- index = new Integer((len > 0) ? 0 : -1);
+ index = new Integer( ( len > 0 ) ? 0 : -1 );
break;
case DynamicSubscript.MID:
- index = new Integer((len > 0) ? (len / 2) : -1);
+ index = new Integer( ( len > 0 ) ? ( len / 2 ) : -1 );
break;
case DynamicSubscript.LAST:
- index = new Integer((len > 0) ? (len - 1) : -1);
+ index = new Integer( ( len > 0 ) ? ( len - 1 ) : -1 );
break;
}
}
- if (result == null)
+ if ( result == null )
{
- if (index instanceof Number)
+ if ( index instanceof Number )
{
- int i = ((Number) index).intValue();
+ int i = ( (Number) index ).intValue();
- result = (i >= 0) ? Array.get(target, i) : null;
- } else
+ result = ( i >= 0 ) ? Array.get( target, i ) : null;
+ }
+ else
{
- throw new NoSuchPropertyException(target, index);
+ throw new NoSuchPropertyException( target, index );
}
}
}
return result;
}
- public void setProperty(Map context, Object target, Object name, Object value)
- throws OgnlException
+ public void setProperty( Map context, Object target, Object name, Object value )
+ throws OgnlException
{
Object index = name;
- boolean isNumber = (index instanceof Number);
+ boolean isNumber = ( index instanceof Number );
- if (isNumber || (index instanceof DynamicSubscript))
+ if ( isNumber || ( index instanceof DynamicSubscript ) )
{
- TypeConverter converter = ((OgnlContext) context).getTypeConverter();
+ TypeConverter converter = ( (OgnlContext) context ).getTypeConverter();
Object convertedValue;
convertedValue =
- converter.convertValue(context, target, null, name.toString(),
- value, target.getClass().getComponentType());
- if (isNumber)
+ converter.convertValue( context, target, null, name.toString(), value,
+ target.getClass().getComponentType() );
+ if ( isNumber )
{
- int i = ((Number) index).intValue();
+ int i = ( (Number) index ).intValue();
- if (i >= 0)
+ if ( i >= 0 )
{
- Array.set(target, i, convertedValue);
+ Array.set( target, i, convertedValue );
}
- } else
+ }
+ else
{
- int len = Array.getLength(target);
+ int len = Array.getLength( target );
- switch(((DynamicSubscript) index).getFlag())
+ switch ( ( (DynamicSubscript) index ).getFlag() )
{
case DynamicSubscript.ALL:
- System.arraycopy(target, 0, convertedValue, 0, len);
+ System.arraycopy( target, 0, convertedValue, 0, len );
return;
case DynamicSubscript.FIRST:
- index = new Integer((len > 0) ? 0 : -1);
+ index = new Integer( ( len > 0 ) ? 0 : -1 );
break;
case DynamicSubscript.MID:
- index = new Integer((len > 0) ? (len / 2) : -1);
+ index = new Integer( ( len > 0 ) ? ( len / 2 ) : -1 );
break;
case DynamicSubscript.LAST:
- index = new Integer((len > 0) ? (len - 1) : -1);
+ index = new Integer( ( len > 0 ) ? ( len - 1 ) : -1 );
break;
}
}
- } else {
- if (name instanceof String)
+ }
+ else
+ {
+ if ( name instanceof String )
{
- super.setProperty(context, target, name, value);
- } else
+ super.setProperty( context, target, name, value );
+ }
+ else
{
- throw new NoSuchPropertyException(target, index);
+ throw new NoSuchPropertyException( target, index );
}
}
}
- public String getSourceAccessor(OgnlContext context, Object target, Object index)
+ public String getSourceAccessor( OgnlContext context, Object target, Object index )
{
String indexStr = index.toString();
// need to convert to primitive for list index access
- // System.out.println("index class " + index.getClass() + " current type " + context.getCurrentType() + " current object class " + context.getCurrentObject().getClass());
+ // System.out.println("index class " + index.getClass() + " current type " + context.getCurrentType() +
+ // " current object class " + context.getCurrentObject().getClass());
- if (context.getCurrentType() != null && !context.getCurrentType().isPrimitive()
- && Number.class.isAssignableFrom(context.getCurrentType()))
+ if ( context.getCurrentType() != null && !context.getCurrentType().isPrimitive()
+ && Number.class.isAssignableFrom( context.getCurrentType() ) )
{
- indexStr += "." + OgnlRuntime.getNumericValueGetter(context.getCurrentType());
- } else if (context.getCurrentObject() != null && Number.class.isAssignableFrom(context.getCurrentObject().getClass())
- && !context.getCurrentType().isPrimitive())
+ indexStr += "." + OgnlRuntime.getNumericValueGetter( context.getCurrentType() );
+ }
+ else if ( context.getCurrentObject() != null
+ && Number.class.isAssignableFrom( context.getCurrentObject().getClass() )
+ && !context.getCurrentType().isPrimitive() )
{
// means it needs to be cast first as well
- String toString = String.class.isInstance(index) && context.getCurrentType() != Object.class ? "" : ".toString()";
+ String toString =
+ String.class.isInstance( index ) && context.getCurrentType() != Object.class ? "" : ".toString()";
indexStr = "org.apache.commons.ognl.OgnlOps#getIntValue(" + indexStr + toString + ")";
}
- context.setCurrentAccessor(target.getClass());
- context.setCurrentType(target.getClass().getComponentType());
+ context.setCurrentAccessor( target.getClass() );
+ context.setCurrentType( target.getClass().getComponentType() );
return "[" + indexStr + "]";
}
- public String getSourceSetter(OgnlContext context, Object target, Object index)
+ public String getSourceSetter( OgnlContext context, Object target, Object index )
{
String indexStr = index.toString();
// need to convert to primitive for list index access
- if (context.getCurrentType() != null && !context.getCurrentType().isPrimitive()
- && Number.class.isAssignableFrom(context.getCurrentType()))
+ if ( context.getCurrentType() != null && !context.getCurrentType().isPrimitive()
+ && Number.class.isAssignableFrom( context.getCurrentType() ) )
{
- indexStr += "." + OgnlRuntime.getNumericValueGetter(context.getCurrentType());
- } else if (context.getCurrentObject() != null && Number.class.isAssignableFrom(context.getCurrentObject().getClass())
- && !context.getCurrentType().isPrimitive())
+ indexStr += "." + OgnlRuntime.getNumericValueGetter( context.getCurrentType() );
+ }
+ else if ( context.getCurrentObject() != null
+ && Number.class.isAssignableFrom( context.getCurrentObject().getClass() )
+ && !context.getCurrentType().isPrimitive() )
{
// means it needs to be cast first as well
- String toString = String.class.isInstance(index) && context.getCurrentType() != Object.class ? "" : ".toString()";
+ String toString =
+ String.class.isInstance( index ) && context.getCurrentType() != Object.class ? "" : ".toString()";
indexStr = "org.apache.commons.ognl.OgnlOps#getIntValue(" + indexStr + toString + ")";
}
Class type = target.getClass().isArray() ? target.getClass().getComponentType() : target.getClass();
- context.setCurrentAccessor(target.getClass());
- context.setCurrentType(target.getClass().getComponentType());
+ context.setCurrentAccessor( target.getClass() );
+ context.setCurrentType( target.getClass().getComponentType() );
- if (type.isPrimitive())
+ if ( type.isPrimitive() )
{
- Class wrapClass = OgnlRuntime.getPrimitiveWrapperClass(type);
-
- return "[" + indexStr + "]=((" + wrapClass.getName() + ")org.apache.commons.ognl.OgnlOps.convertValue($3," + wrapClass.getName()
- + ".class, true))." + OgnlRuntime.getNumericValueGetter(wrapClass);
- } else
+ Class wrapClass = OgnlRuntime.getPrimitiveWrapperClass( type );
+
+ return "[" + indexStr + "]=((" + wrapClass.getName() + ")org.apache.commons.ognl.OgnlOps.convertValue($3,"
+ + wrapClass.getName() + ".class, true))." + OgnlRuntime.getNumericValueGetter( wrapClass );
+ }
+ else
{
return "[" + indexStr + "]=org.apache.commons.ognl.OgnlOps.convertValue($3," + type.getName() + ".class)";
}
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/BooleanExpression.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/BooleanExpression.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/BooleanExpression.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/BooleanExpression.java Sat May 14 13:18:29 2011
@@ -24,66 +24,73 @@ package org.apache.commons.ognl;
import org.apache.commons.ognl.enhance.UnsupportedCompilationException;
-
/**
* Base class for boolean expressions.
*
* @author jkuhnert
*/
-public abstract class BooleanExpression extends ExpressionNode implements NodeType
+public abstract class BooleanExpression
+ extends ExpressionNode
+ implements NodeType
{
-
+
protected Class _getterClass;
-
- public BooleanExpression(int id) {
- super(id);
+
+ public BooleanExpression( int id )
+ {
+ super( id );
}
- public BooleanExpression(OgnlParser p, int id) {
- super(p, id);
+ public BooleanExpression( OgnlParser p, int id )
+ {
+ super( p, id );
}
public Class getGetterClass()
{
return _getterClass;
}
-
+
public Class getSetterClass()
{
return null;
}
-
- public String toGetSourceString(OgnlContext context, Object target)
+
+ public String toGetSourceString( OgnlContext context, Object target )
{
- try {
-
- Object value = getValueBody(context, target);
-
- if (value != null && Boolean.class.isAssignableFrom(value.getClass()))
+ try
+ {
+
+ Object value = getValueBody( context, target );
+
+ if ( value != null && Boolean.class.isAssignableFrom( value.getClass() ) )
_getterClass = Boolean.TYPE;
- else if (value != null)
+ else if ( value != null )
_getterClass = value.getClass();
else
_getterClass = Boolean.TYPE;
- String ret = super.toGetSourceString(context, target);
+ String ret = super.toGetSourceString( context, target );
- if ("(false)".equals(ret))
+ if ( "(false)".equals( ret ) )
return "false";
- else if ("(true)".equals(ret))
+ else if ( "(true)".equals( ret ) )
return "true";
-
+
return ret;
-
- } catch (NullPointerException e) {
-
+
+ }
+ catch ( NullPointerException e )
+ {
+
// expected to happen in some instances
e.printStackTrace();
-
- throw new UnsupportedCompilationException("evaluation resulted in null expression.");
- } catch (Throwable t)
+
+ throw new UnsupportedCompilationException( "evaluation resulted in null expression." );
+ }
+ catch ( Throwable t )
{
- throw OgnlOps.castToRuntime(t);
+ throw OgnlOps.castToRuntime( t );
}
}
}
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ClassCacheInspector.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ClassCacheInspector.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ClassCacheInspector.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ClassCacheInspector.java Sat May 14 13:18:29 2011
@@ -20,18 +20,17 @@
package org.apache.commons.ognl;
/**
- * Optional interface that may be registered with {@link OgnlRuntime#setClassCacheInspector(ClassCacheInspector)} as
- * a means to disallow caching of specific class types.
+ * Optional interface that may be registered with {@link OgnlRuntime#setClassCacheInspector(ClassCacheInspector)} as a
+ * means to disallow caching of specific class types.
*/
-public interface ClassCacheInspector {
+public interface ClassCacheInspector
+{
/**
* Invoked just before storing a class type within a cache instance.
- *
- * @param type
- * The class that is to be stored.
- *
+ *
+ * @param type The class that is to be stored.
* @return True if the class can be cached, false otherwise.
*/
- boolean shouldCache(Class type);
+ boolean shouldCache( Class type );
}
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ClassResolver.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ClassResolver.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ClassResolver.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ClassResolver.java Sat May 14 13:18:29 2011
@@ -22,12 +22,13 @@ package org.apache.commons.ognl;
import java.util.Map;
/**
- * This interface defines an object that will resolve a class from a string
- * and a ognl context table.
+ * This interface defines an object that will resolve a class from a string and a ognl context table.
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
public interface ClassResolver
{
- public Class classForName(String className, Map context) throws ClassNotFoundException;
+ public Class classForName( String className, Map context )
+ throws ClassNotFoundException;
}
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/CollectionElementsAccessor.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/CollectionElementsAccessor.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/CollectionElementsAccessor.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/CollectionElementsAccessor.java Sat May 14 13:18:29 2011
@@ -23,13 +23,15 @@ import java.util.*;
/**
* Implementation of ElementsAccessor that returns a collection's iterator.
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-public class CollectionElementsAccessor implements ElementsAccessor
+public class CollectionElementsAccessor
+ implements ElementsAccessor
{
public Enumeration getElements( Object target )
{
- return new IteratorEnumeration( ((Collection)target).iterator() );
+ return new IteratorEnumeration( ( (Collection) target ).iterator() );
}
}
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ComparisonExpression.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ComparisonExpression.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ComparisonExpression.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ComparisonExpression.java Sat May 14 13:18:29 2011
@@ -24,70 +24,77 @@ package org.apache.commons.ognl;
import org.apache.commons.ognl.enhance.UnsupportedCompilationException;
-
/**
- * Base class for types that compare values.
+ * Base class for types that compare values.
*/
-public abstract class ComparisonExpression extends BooleanExpression
+public abstract class ComparisonExpression
+ extends BooleanExpression
{
- public ComparisonExpression(int id) {
- super(id);
+ public ComparisonExpression( int id )
+ {
+ super( id );
}
- public ComparisonExpression(OgnlParser p, int id) {
- super(p, id);
+ public ComparisonExpression( OgnlParser p, int id )
+ {
+ super( p, id );
}
-
+
public abstract String getComparisonFunction();
-
- public String toGetSourceString(OgnlContext context, Object target)
+
+ public String toGetSourceString( OgnlContext context, Object target )
{
- if (target == null)
- throw new UnsupportedCompilationException("Current target is null, can't compile.");
-
- try {
-
- Object value = getValueBody(context, target);
-
- if (value != null && Boolean.class.isAssignableFrom(value.getClass()))
+ if ( target == null )
+ throw new UnsupportedCompilationException( "Current target is null, can't compile." );
+
+ try
+ {
+
+ Object value = getValueBody( context, target );
+
+ if ( value != null && Boolean.class.isAssignableFrom( value.getClass() ) )
_getterClass = Boolean.TYPE;
- else if (value != null)
+ else if ( value != null )
_getterClass = value.getClass();
else
_getterClass = Boolean.TYPE;
-
+
// iterate over children to make numeric type detection work properly
-
- OgnlRuntime.getChildSource(context, target, _children[0]);
- OgnlRuntime.getChildSource(context, target, _children[1]);
-
-// System.out.println("comparison expression currentType: " + context.getCurrentType() + " previousType: " + context.getPreviousType());
- boolean conversion = OgnlRuntime.shouldConvertNumericTypes(context);
+ OgnlRuntime.getChildSource( context, target, _children[0] );
+ OgnlRuntime.getChildSource( context, target, _children[1] );
+
+ // System.out.println("comparison expression currentType: " + context.getCurrentType() + " previousType: " +
+ // context.getPreviousType());
+
+ boolean conversion = OgnlRuntime.shouldConvertNumericTypes( context );
String result = conversion ? "(" + getComparisonFunction() + "( ($w) (" : "(";
-
- result += OgnlRuntime.getChildSource(context, target, _children[0], conversion)
- + " "
- + (conversion ? "), ($w) " : getExpressionOperator(0)) + " "
- + OgnlRuntime.getChildSource(context, target, _children[1], conversion);
-
+
+ result +=
+ OgnlRuntime.getChildSource( context, target, _children[0], conversion ) + " "
+ + ( conversion ? "), ($w) " : getExpressionOperator( 0 ) ) + " "
+ + OgnlRuntime.getChildSource( context, target, _children[1], conversion );
+
result += conversion ? ")" : "";
- context.setCurrentType(Boolean.TYPE);
+ context.setCurrentType( Boolean.TYPE );
result += ")";
return result;
- } catch (NullPointerException e) {
-
+ }
+ catch ( NullPointerException e )
+ {
+
// expected to happen in some instances
-
- throw new UnsupportedCompilationException("evaluation resulted in null expression.");
- } catch (Throwable t)
+
+ throw new UnsupportedCompilationException( "evaluation resulted in null expression." );
+ }
+ catch ( Throwable t )
{
- throw OgnlOps.castToRuntime(t);
+ throw OgnlOps.castToRuntime( t );
}
}
}
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultClassResolver.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultClassResolver.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultClassResolver.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultClassResolver.java Sat May 14 13:18:29 2011
@@ -22,36 +22,44 @@ package org.apache.commons.ognl;
import java.util.*;
/**
- * Default class resolution. Uses Class.forName() 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.
+ * Default class resolution. Uses Class.forName() 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)
* @author Drew Davidson (drew@ognl.org)
*/
-public class DefaultClassResolver extends Object implements ClassResolver
+public class DefaultClassResolver
+ extends Object
+ implements ClassResolver
{
- private Map classes = new HashMap(101);
+ private Map classes = new HashMap( 101 );
public DefaultClassResolver()
{
super();
}
- public Class classForName(String className, Map context) throws ClassNotFoundException
- {
- Class result = null;
+ public Class classForName( String className, Map context )
+ throws ClassNotFoundException
+ {
+ Class result = null;
- if ((result = (Class)classes.get(className)) == null) {
- try {
- result = Class.forName(className);
- } catch (ClassNotFoundException ex) {
- if (className.indexOf('.') == -1) {
- result = Class.forName("java.lang." + className);
- classes.put("java.lang." + className, result);
- }
- }
- classes.put(className, result);
- }
- return result;
- }
+ if ( ( result = (Class) classes.get( className ) ) == null )
+ {
+ try
+ {
+ result = Class.forName( className );
+ }
+ catch ( ClassNotFoundException ex )
+ {
+ if ( className.indexOf( '.' ) == -1 )
+ {
+ result = Class.forName( "java.lang." + className );
+ classes.put( "java.lang." + className, result );
+ }
+ }
+ classes.put( className, result );
+ }
+ return result;
+ }
}
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultMemberAccess.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultMemberAccess.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultMemberAccess.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultMemberAccess.java Sat May 14 13:18:29 2011
@@ -23,117 +23,130 @@ import java.lang.reflect.*;
import java.util.*;
/**
- * This class provides methods for setting up and restoring
- * access in a Field. Java 2 provides access utilities for setting
- * and getting fields that are non-public. This object provides
- * coarse-grained access controls to allow access to private, protected
- * and package protected members. This will apply to all classes
- * and members.
- *
+ * This class provides methods for setting up and restoring access in a Field. Java 2 provides access utilities for
+ * setting and getting fields that are non-public. This object provides coarse-grained access controls to allow access
+ * to private, protected and package protected members. This will apply to all classes and members.
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
* @version 15 October 1999
*/
-public class DefaultMemberAccess implements MemberAccess
+public class DefaultMemberAccess
+ implements MemberAccess
{
- public boolean allowPrivateAccess = false;
- public boolean allowProtectedAccess = false;
- public boolean allowPackageProtectedAccess = false;
-
- /*===================================================================
- Constructors
- ===================================================================*/
- public DefaultMemberAccess(boolean allowAllAccess)
- {
- this(allowAllAccess, allowAllAccess, allowAllAccess);
- }
-
- public DefaultMemberAccess(boolean allowPrivateAccess, boolean allowProtectedAccess, boolean allowPackageProtectedAccess)
- {
- super();
- this.allowPrivateAccess = allowPrivateAccess;
- this.allowProtectedAccess = allowProtectedAccess;
- this.allowPackageProtectedAccess = allowPackageProtectedAccess;
- }
-
- /*===================================================================
- Public methods
- ===================================================================*/
- public boolean getAllowPrivateAccess()
- {
- return allowPrivateAccess;
- }
-
- public void setAllowPrivateAccess(boolean value)
- {
- allowPrivateAccess = value;
- }
-
- public boolean getAllowProtectedAccess()
- {
- return allowProtectedAccess;
- }
-
- public void setAllowProtectedAccess(boolean value)
- {
- allowProtectedAccess = value;
- }
-
- public boolean getAllowPackageProtectedAccess()
- {
- return allowPackageProtectedAccess;
- }
-
- public void setAllowPackageProtectedAccess(boolean value)
- {
- allowPackageProtectedAccess = value;
- }
-
- /*===================================================================
- MemberAccess interface
- ===================================================================*/
- public Object setup(Map context, Object target, Member member, String propertyName)
+ public boolean allowPrivateAccess = false;
+
+ public boolean allowProtectedAccess = false;
+
+ public boolean allowPackageProtectedAccess = false;
+
+ /*
+ * =================================================================== Constructors
+ * ===================================================================
+ */
+ public DefaultMemberAccess( boolean allowAllAccess )
{
- Object result = null;
+ this( allowAllAccess, allowAllAccess, allowAllAccess );
+ }
- if (isAccessible(context, target, member, propertyName)) {
- AccessibleObject accessible = (AccessibleObject)member;
+ public DefaultMemberAccess( boolean allowPrivateAccess, boolean allowProtectedAccess,
+ boolean allowPackageProtectedAccess )
+ {
+ super();
+ this.allowPrivateAccess = allowPrivateAccess;
+ this.allowProtectedAccess = allowProtectedAccess;
+ this.allowPackageProtectedAccess = allowPackageProtectedAccess;
+ }
- if (!accessible.isAccessible()) {
+ /*
+ * =================================================================== Public methods
+ * ===================================================================
+ */
+ public boolean getAllowPrivateAccess()
+ {
+ return allowPrivateAccess;
+ }
+
+ public void setAllowPrivateAccess( boolean value )
+ {
+ allowPrivateAccess = value;
+ }
+
+ public boolean getAllowProtectedAccess()
+ {
+ return allowProtectedAccess;
+ }
+
+ public void setAllowProtectedAccess( boolean value )
+ {
+ allowProtectedAccess = value;
+ }
+
+ public boolean getAllowPackageProtectedAccess()
+ {
+ return allowPackageProtectedAccess;
+ }
+
+ public void setAllowPackageProtectedAccess( boolean value )
+ {
+ allowPackageProtectedAccess = value;
+ }
+
+ /*
+ * =================================================================== MemberAccess interface
+ * ===================================================================
+ */
+ public Object setup( Map context, Object target, Member member, String propertyName )
+ {
+ Object result = null;
+
+ if ( isAccessible( context, target, member, propertyName ) )
+ {
+ AccessibleObject accessible = (AccessibleObject) member;
+
+ if ( !accessible.isAccessible() )
+ {
result = Boolean.TRUE;
- accessible.setAccessible(true);
+ accessible.setAccessible( true );
}
}
return result;
}
- public void restore(Map context, Object target, Member member, String propertyName, Object state)
+ public void restore( Map context, Object target, Member member, String propertyName, Object state )
{
- if (state != null) {
- ((AccessibleObject)member).setAccessible(((Boolean)state).booleanValue());
+ if ( state != null )
+ {
+ ( (AccessibleObject) member ).setAccessible( ( (Boolean) state ).booleanValue() );
}
}
/**
- Returns true if the given member is accessible or can be made accessible
- by this object.
+ * Returns true if the given member is accessible or can be made accessible by this object.
*/
- public boolean isAccessible(Map context, Object target, Member member, String propertyName)
- {
- int modifiers = member.getModifiers();
- boolean result = Modifier.isPublic(modifiers);
-
- if (!result) {
- if (Modifier.isPrivate(modifiers)) {
- result = getAllowPrivateAccess();
- } else {
- if (Modifier.isProtected(modifiers)) {
- result = getAllowProtectedAccess();
- } else {
- result = getAllowPackageProtectedAccess();
- }
- }
- }
- return result;
- }
+ public boolean isAccessible( Map context, Object target, Member member, String propertyName )
+ {
+ int modifiers = member.getModifiers();
+ boolean result = Modifier.isPublic( modifiers );
+
+ if ( !result )
+ {
+ if ( Modifier.isPrivate( modifiers ) )
+ {
+ result = getAllowPrivateAccess();
+ }
+ else
+ {
+ if ( Modifier.isProtected( modifiers ) )
+ {
+ result = getAllowProtectedAccess();
+ }
+ else
+ {
+ result = getAllowPackageProtectedAccess();
+ }
+ }
+ }
+ return result;
+ }
}
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultTypeConverter.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultTypeConverter.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultTypeConverter.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DefaultTypeConverter.java Sat May 14 13:18:29 2011
@@ -23,25 +23,27 @@ import java.lang.reflect.Member;
import java.util.Map;
/**
- * Default type conversion. Converts among numeric types and also strings.
+ * Default type conversion. Converts among numeric types and also strings.
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-public class DefaultTypeConverter implements TypeConverter
+public class DefaultTypeConverter
+ implements TypeConverter
{
public DefaultTypeConverter()
{
super();
}
- public Object convertValue(Map context, Object value, Class toType)
+ public Object convertValue( Map context, Object value, Class toType )
{
- return OgnlOps.convertValue(value, toType);
+ return OgnlOps.convertValue( value, toType );
}
- public Object convertValue(Map context, Object target, Member member, String propertyName, Object value, Class toType)
+ public Object convertValue( Map context, Object target, Member member, String propertyName, Object value,
+ Class toType )
{
- return convertValue(context, value, toType);
+ return convertValue( context, value, toType );
}
}
-
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DynamicSubscript.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DynamicSubscript.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DynamicSubscript.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/DynamicSubscript.java Sat May 14 13:18:29 2011
@@ -19,26 +19,31 @@
*/
package org.apache.commons.ognl;
-
/**
- * This class has predefined instances that stand for OGNL's special "dynamic subscripts"
- * for getting at the first, middle, or last elements of a list. In OGNL expressions,
- * these subscripts look like special kinds of array indexes: [^] means the first element,
- * [$] means the last, [|] means the middle, and [*] means the whole list.
+ * This class has predefined instances that stand for OGNL's special "dynamic subscripts" for getting at the first,
+ * middle, or last elements of a list. In OGNL expressions, these subscripts look like special kinds of array indexes:
+ * [^] means the first element, [$] means the last, [|] means the middle, and [*] means the whole list.
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
public class DynamicSubscript
{
- public static final int FIRST = 0;
- public static final int MID = 1;
- public static final int LAST = 2;
- public static final int ALL = 3;
-
- public static final DynamicSubscript first = new DynamicSubscript(FIRST);
- public static final DynamicSubscript mid = new DynamicSubscript(MID);
- public static final DynamicSubscript last = new DynamicSubscript(LAST);
- public static final DynamicSubscript all = new DynamicSubscript(ALL);
+ public static final int FIRST = 0;
+
+ public static final int MID = 1;
+
+ public static final int LAST = 2;
+
+ public static final int ALL = 3;
+
+ public static final DynamicSubscript first = new DynamicSubscript( FIRST );
+
+ public static final DynamicSubscript mid = new DynamicSubscript( MID );
+
+ public static final DynamicSubscript last = new DynamicSubscript( LAST );
+
+ public static final DynamicSubscript all = new DynamicSubscript( ALL );
private int flag;
@@ -54,13 +59,18 @@ public class DynamicSubscript
public String toString()
{
- switch (flag)
- {
- case FIRST: return "^";
- case MID: return "|";
- case LAST: return "$";
- case ALL: return "*";
- default: return "?"; // Won't happen
- }
+ switch ( flag )
+ {
+ case FIRST:
+ return "^";
+ case MID:
+ return "|";
+ case LAST:
+ return "$";
+ case ALL:
+ return "*";
+ default:
+ return "?"; // Won't happen
+ }
}
}
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ElementsAccessor.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ElementsAccessor.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ElementsAccessor.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/ElementsAccessor.java Sat May 14 13:18:29 2011
@@ -22,24 +22,25 @@ package org.apache.commons.ognl;
import java.util.Enumeration;
/**
- * This interface defines a method for getting the "elements" of an object, which means
- * any objects that naturally would be considered to be contained by the object. So for a
- * collection, you would expect this method to return all the objects in that collection;
- * while for an ordinary object you would expect this method to return just that object.
- *
- * <p> An implementation of this interface will often require that its target objects all
- * be of some particular type. For example, the MapElementsAccessor class requires that
- * its targets all implement the Map interface.
+ * This interface defines a method for getting the "elements" of an object, which means any objects that naturally would
+ * be considered to be contained by the object. So for a collection, you would expect this method to return all the
+ * objects in that collection; while for an ordinary object you would expect this method to return just that object.
+ * <p>
+ * An implementation of this interface will often require that its target objects all be of some particular type. For
+ * example, the MapElementsAccessor class requires that its targets all implement the Map interface.
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
public interface ElementsAccessor
{
- /**
- * Returns an iterator over the elements of the given target object.
- * @param target the object to get the elements of
- * @return an iterator over the elements of the given object
- * @exception OgnlException if there is an error getting the given object's elements
- */
- public Enumeration getElements( Object target ) throws OgnlException;
+ /**
+ * Returns an iterator over the elements of the given target object.
+ *
+ * @param target the object to get the elements of
+ * @return an iterator over the elements of the given object
+ * @exception OgnlException if there is an error getting the given object's elements
+ */
+ public Enumeration getElements( Object target )
+ throws OgnlException;
}
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/EnumerationElementsAccessor.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/EnumerationElementsAccessor.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/EnumerationElementsAccessor.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/EnumerationElementsAccessor.java Sat May 14 13:18:29 2011
@@ -21,17 +21,18 @@ package org.apache.commons.ognl;
import java.util.Enumeration;
-
/**
- * Implementation of the ElementsAccessor interface for Enumerations, which returns an
- * iterator that passes its calls through to the target Enumeration.
+ * Implementation of the ElementsAccessor interface for Enumerations, which returns an iterator that passes its calls
+ * through to the target Enumeration.
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-public class EnumerationElementsAccessor implements ElementsAccessor
+public class EnumerationElementsAccessor
+ implements ElementsAccessor
{
public Enumeration getElements( Object target )
{
- return (Enumeration)target;
+ return (Enumeration) target;
}
}
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/EnumerationIterator.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/EnumerationIterator.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/EnumerationIterator.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/EnumerationIterator.java Sat May 14 13:18:29 2011
@@ -23,31 +23,33 @@ import java.util.*;
/**
* Object that implements Iterator from an Enumeration
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-public class EnumerationIterator implements Iterator
+public class EnumerationIterator
+ implements Iterator
{
- private Enumeration e;
+ private Enumeration e;
- public EnumerationIterator(Enumeration e)
- {
- super();
- this.e = e;
- }
+ public EnumerationIterator( Enumeration e )
+ {
+ super();
+ this.e = e;
+ }
- public boolean hasNext()
- {
- return e.hasMoreElements();
- }
+ public boolean hasNext()
+ {
+ return e.hasMoreElements();
+ }
- public Object next()
- {
- return e.nextElement();
- }
+ public Object next()
+ {
+ return e.nextElement();
+ }
- public void remove()
- {
- throw new UnsupportedOperationException("remove() not supported by Enumeration");
- }
+ public void remove()
+ {
+ throw new UnsupportedOperationException( "remove() not supported by Enumeration" );
+ }
}
Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/EnumerationPropertyAccessor.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/EnumerationPropertyAccessor.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/EnumerationPropertyAccessor.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/EnumerationPropertyAccessor.java Sat May 14 13:18:29 2011
@@ -22,37 +22,49 @@ package org.apache.commons.ognl;
import java.util.*;
/**
- * Implementation of PropertyAccessor that provides "property" reference to
- * "nextElement" (aliases to "next" also) and "hasMoreElements" (also aliased
- * to "hasNext").
+ * Implementation of PropertyAccessor that provides "property" reference to "nextElement" (aliases to "next" also) and
+ * "hasMoreElements" (also aliased to "hasNext").
+ *
* @author Luke Blanshard (blanshlu@netscape.net)
* @author Drew Davidson (drew@ognl.org)
*/
-public class EnumerationPropertyAccessor extends ObjectPropertyAccessor
+public class EnumerationPropertyAccessor
+ extends ObjectPropertyAccessor
implements PropertyAccessor // This is here to make javadoc show this class as an implementor
{
- public Object getProperty( Map context, Object target, Object name ) throws OgnlException
+ public Object getProperty( Map context, Object target, Object name )
+ throws OgnlException
{
- Object result;
- Enumeration e = (Enumeration)target;
+ Object result;
+ Enumeration e = (Enumeration) target;
- if ( name instanceof String ) {
- if (name.equals("next") || name.equals("nextElement")) {
+ if ( name instanceof String )
+ {
+ if ( name.equals( "next" ) || name.equals( "nextElement" ) )
+ {
result = e.nextElement();
- } else {
- if (name.equals("hasNext") || name.equals("hasMoreElements")) {
+ }
+ else
+ {
+ if ( name.equals( "hasNext" ) || name.equals( "hasMoreElements" ) )
+ {
result = e.hasMoreElements() ? Boolean.TRUE : Boolean.FALSE;
- } else {
+ }
+ else
+ {
result = super.getProperty( context, target, name );
}
}
- } else {
- result = super.getProperty(context, target, name);
+ }
+ else
+ {
+ result = super.getProperty( context, target, name );
}
return result;
}
- public void setProperty( Map context, Object target, Object name, Object value ) throws OgnlException
+ public void setProperty( Map context, Object target, Object name, Object value )
+ throws OgnlException
{
throw new IllegalArgumentException( "can't set property " + name + " on Enumeration" );
}