commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1102930 - /incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlContext.java
Date Sat, 14 May 2011 00:06:05 GMT
Author: simonetripodi
Date: Sat May 14 00:06:04 2011
New Revision: 1102930

URL: http://svn.apache.org/viewvc?rev=1102930&view=rev
Log:
used the Stack to implement the Stack

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=1102930&r1=1102929&r2=1102930&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
00:06:04 2011
@@ -92,7 +92,7 @@ public class OgnlContext extends Object 
         }
     }
 
-    private List _typeStack = new ArrayList();
+    private Stack<Class<?>> _typeStack = new Stack<Class<?>>();
     private List _accessorStack = new ArrayList();
 
     private int _localReferenceCounter = 0;
@@ -298,15 +298,17 @@ public class OgnlContext extends Object 
      * 
      * @return The current object type, may be null.
      */
-    public Class getCurrentType()
+    public Class<?> getCurrentType()
     {
         if (_typeStack.isEmpty())
+        {
             return null;
+        }
 
-       return (Class) _typeStack.get(_typeStack.size() - 1); 
+       return _typeStack.peek(); 
     }
     
-    public void setCurrentType(Class type)
+    public void setCurrentType(Class<?> type)
     {
         _typeStack.add(type);
     }
@@ -317,31 +319,39 @@ public class OgnlContext extends Object 
      * 
      * @return The previous type of object on the stack, may be null.
      */
-    public Class getPreviousType()
+    public Class<?> getPreviousType()
     {
         if (_typeStack.isEmpty())
+        {
             return null;
+        }
 
         if (_typeStack.size() > 1)
-            return (Class)_typeStack.get(_typeStack.size() - 2);
-        else
-            return null;
+        {
+            return _typeStack.get(_typeStack.size() - 2);
+        }
+
+        return null;
     }
     
-    public void setPreviousType(Class type)
+    public void setPreviousType(Class<?> type)
     {
         if (_typeStack.isEmpty() || _typeStack.size() < 2)
+        {
             return;
+        }
 
         _typeStack.set(_typeStack.size() - 2, type);
     }
 
-    public Class getFirstType()
+    public Class<?> getFirstType()
     {
         if (_typeStack.isEmpty())
+        {
             return null;
+        }
 
-        return (Class)_typeStack.get(0);
+        return _typeStack.get(0);
     }
 
     public void setCurrentNode(Node value)



Mime
View raw message