View Javadoc

1   /*
2    * $Id: SMDActionTest2.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 org.apache.struts2.json.annotations.SMD;
24  import org.apache.struts2.json.annotations.SMDMethod;
25  import org.apache.struts2.json.annotations.SMDMethodParameter;
26  
27  @SMD(objectName = "testaction", serviceType = "service", version = "10.0")
28  public class SMDActionTest2 {
29      private boolean doSomethingInvoked;
30  
31      @SMDMethod
32      public void add(@SMDMethodParameter(name = "a")
33      int a, @SMDMethodParameter(name = "b")
34      int b) {
35      }
36  
37      @SMDMethod(name = "doSomethingElse")
38      public void doSomething() {
39          doSomethingInvoked = true;
40      }
41  
42      @SMDMethod
43      public Bean getBean() {
44          Bean bean = new Bean();
45          bean.setStringField("str");
46          bean.setBooleanField(true);
47          bean.setCharField('s');
48          bean.setDoubleField(10.1);
49          bean.setFloatField(1.5f);
50          bean.setIntField(10);
51          bean.setLongField(100);
52          return bean;
53      }
54  
55      public boolean isDoSomethingInvoked() {
56          return doSomethingInvoked;
57      }
58  }