View Javadoc

1   /*
2    * $Id: TestAction.java 799110 2009-07-29 22:44:26Z musachy $
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  package org.apache.struts2.json;
22  
23  import java.util.Date;
24  import java.util.List;
25  import java.util.Map;
26  
27  import org.apache.struts2.json.annotations.JSON;
28  
29  import com.opensymphony.xwork2.Action;
30  import com.opensymphony.xwork2.ActionSupport;
31  
32  /***
33   */
34  @SuppressWarnings("unchecked")
35  public class TestAction extends ActionSupport {
36      private static final long serialVersionUID = -8891365561914451494L;
37      private List collection;
38      private List collection2;
39      private Map map;
40      private String foo;
41      private String result;
42      private String[] array;
43      private Bean[] beanArray;
44      private int[] intArray;
45      private List list;
46      private String bar;
47      private String nogetter;
48      private Date date2;
49      private Bean bean;
50      private Date date;
51      private String foo2 = null;
52  
53      public Bean getBean() {
54          return this.bean;
55      }
56  
57      public void setBean(Bean bean) {
58          this.bean = bean;
59      }
60  
61      public List getCollection() {
62          return this.collection;
63      }
64  
65      public void setCollection(List collection) {
66          this.collection = collection;
67      }
68  
69      public List getCollection2() {
70          return this.collection2;
71      }
72  
73      public void setCollection2(List collection2) {
74          this.collection2 = collection2;
75      }
76  
77      public Map getMap() {
78          return this.map;
79      }
80  
81      public void setMap(Map map) {
82          this.map = map;
83      }
84  
85      public String getFoo() {
86          return this.foo;
87      }
88  
89      public void setFoo(String foo) {
90          this.foo = foo;
91      }
92  
93      public String getResult() {
94          return this.result;
95      }
96  
97      public void setResult(String result) {
98          this.result = result;
99      }
100 
101     public String[] getArray() {
102         return this.array;
103     }
104 
105     public void setArray(String[] array) {
106         this.array = array;
107     }
108 
109     public List getList() {
110         return this.list;
111     }
112 
113     public void setList(List list) {
114         this.list = list;
115     }
116 
117     @Override
118     public String execute() throws Exception {
119         if (this.result == null) {
120             this.result = Action.SUCCESS;
121         }
122 
123         return this.result;
124     }
125 
126     public String doInput() throws Exception {
127         return INPUT;
128     }
129 
130     public void setBar(String bar) {
131         this.bar = bar;
132     }
133 
134     @JSON(serialize = false)
135     public String getBar() {
136         return this.bar;
137     }
138 
139     public void setNogetter(String nogetter) {
140         this.nogetter = nogetter;
141     }
142 
143     @JSON(serialize = false)
144     public int[] getIntArray() {
145         return this.intArray;
146     }
147 
148     public void setIntArray(int[] intArray) {
149         this.intArray = intArray;
150     }
151 
152     @JSON(serialize = false)
153     public Bean[] getBeanArray() {
154         return this.beanArray;
155     }
156 
157     public void setBeanArray(Bean[] beanArray) {
158         this.beanArray = beanArray;
159     }
160 
161     public Date getDate() {
162         return this.date;
163     }
164 
165     public void setDate(Date date) {
166         this.date = date;
167     }
168 
169     @JSON(format = "dd/MM/yy")
170     public Date getDate2() {
171         return this.date2;
172     }
173 
174     @JSON(format = "dd/MM/yy")
175     public void setDate2(Date date2) {
176         this.date2 = date2;
177     }
178 
179     @JSON(serialize = false)
180     public String getFoo2() {
181         return this.foo2;
182     }
183 
184     @JSON(deserialize = false)
185     public void setFoo2(String foo2) {
186         this.foo2 = foo2;
187     }
188 }