View Javadoc

1   // Copyright 2006 Google Inc. All Rights Reserved.
2   
3   package org.apache.struts2.impl;
4   
5   import java.util.Iterator;
6   
7   import org.apache.struts2.spi.ValueStack;
8   
9   import com.opensymphony.xwork2.util.ValueStackFactory;
10  
11  public class ValueStackAdapter implements ValueStack {
12  
13      final com.opensymphony.xwork2.util.ValueStack delegate;
14  
15      public ValueStackAdapter(com.opensymphony.xwork2.util.ValueStack delegate) {
16          this.delegate = delegate;
17      }
18  
19      public Object peek() {
20          return delegate.peek();
21      }
22  
23      public Object pop() {
24          return delegate.pop();
25      }
26  
27      public void push(Object o) {
28          delegate.push(o);
29      }
30  
31      public ValueStack clone() {
32          return new ValueStackAdapter(ValueStackFactory.getFactory().createValueStack(delegate));
33      }
34  
35      public Object get(String expr) {
36          return delegate.findValue(expr);
37      }
38  
39      public <T> T get(String expr, Class<T> requiredType) {
40          return (T) delegate.findValue(expr, requiredType);
41      }
42  
43      public String getString(String expr) {
44          return delegate.findString(expr);
45      }
46  
47      public void set(String expr, Object o) {
48          delegate.set(expr, o);
49      }
50  
51      public int size() {
52          return delegate.size();
53      }
54  
55      public Iterator<Object> iterator() {
56          return delegate.getRoot().iterator();
57      }
58  }