commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1102998 - /incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlContext.java
Date Sat, 14 May 2011 10:03:21 GMT
Author: simonetripodi
Date: Sat May 14 10:03:21 2011
New Revision: 1102998

URL: http://svn.apache.org/viewvc?rev=1102998&view=rev
Log:
used the Stack to model the _accessorStack

Modified:
    incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlContext.java

Modified: incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlContext.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlContext.java?rev=1102998&r1=1102997&r2=1102998&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlContext.java (original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlContext.java Sat May 14
10:03:21 2011
@@ -93,7 +93,7 @@ public class OgnlContext extends Object 
     }
 
     private Stack<Class<?>> _typeStack = new Stack<Class<?>>();
-    private List _accessorStack = new ArrayList();
+    private Stack<Class<?>> _accessorStack = new Stack<Class<?>>();
 
     private int _localReferenceCounter = 0;
     private Map _localReferenceMap = null;
@@ -261,36 +261,43 @@ public class OgnlContext extends Object 
         return _currentObject;
     }
     
-    public void setCurrentAccessor(Class type)
+    public void setCurrentAccessor(Class<?> type)
     {
         _accessorStack.add(type);        
     }
     
-    public Class getCurrentAccessor()
+    public Class<?> getCurrentAccessor()
     {
         if (_accessorStack.isEmpty())
+        {
             return null;
-        
-        return (Class) _accessorStack.get(_accessorStack.size() - 1);
+        }
+
+        return _accessorStack.peek();
     }
     
-    public Class getPreviousAccessor()
+    public Class<?> getPreviousAccessor()
     {
         if (_accessorStack.isEmpty())
+        {
             return null;
+        }
 
-        if (_accessorStack.size() > 1)
-            return (Class) _accessorStack.get(_accessorStack.size() - 2);
-        else
-            return null;
+        if (_accessorStack.size() > 1) {
+            return _accessorStack.get(_accessorStack.size() - 2);
+        }
+
+        return null;
     }
 
-    public Class getFirstAccessor()
+    public Class<?> getFirstAccessor()
     {
         if (_accessorStack.isEmpty())
+        {
             return null;
+        }
 
-        return (Class)_accessorStack.get(0);
+        return _accessorStack.get(0);
     }
 
     /**



Mime
View raw message