01: /*
02: * Copyright 2007 Google Inc.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License. You may obtain a copy of
06: * the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13: * License for the specific language governing permissions and limitations under
14: * the License.
15: */
16: package com.google.gwt.user.server.rpc;
17:
18: import com.google.gwt.user.client.rpc.InheritanceTestSetFactory;
19: import com.google.gwt.user.client.rpc.InheritanceTestSetValidator;
20: import com.google.gwt.user.client.rpc.InheritanceTestServiceSubtype;
21: import com.google.gwt.user.client.rpc.InheritanceTestSetFactory.AbstractClass;
22: import com.google.gwt.user.client.rpc.InheritanceTestSetFactory.MySerializableInterface;
23: import com.google.gwt.user.client.rpc.InheritanceTestSetFactory.AnonymousClassInterface;
24: import com.google.gwt.user.client.rpc.InheritanceTestSetFactory.Circle;
25: import com.google.gwt.user.client.rpc.InheritanceTestSetFactory.JavaSerializableClass;
26: import com.google.gwt.user.client.rpc.InheritanceTestSetFactory.SerializableClass;
27: import com.google.gwt.user.client.rpc.InheritanceTestSetFactory.SerializableClassWithTransientField;
28:
29: /**
30: * Servlet used by the
31: * {@link com.google.gwt.user.client.rpc.InheritanceTest InheritanceTest} unit
32: * test.
33: */
34: public class InheritanceTestServiceImpl extends RemoteServiceServlet
35: implements InheritanceTestServiceSubtype {
36:
37: public AnonymousClassInterface echo(
38: AnonymousClassInterface serializable) {
39: return serializable;
40: }
41:
42: public Circle echo(Circle circle) {
43: return circle;
44: }
45:
46: public JavaSerializableClass echo(
47: JavaSerializableClass javaSerializableClass) {
48: return javaSerializableClass;
49: }
50:
51: public SerializableClass echo(SerializableClass serializableClass) {
52: if (!InheritanceTestSetValidator.isValid(serializableClass)) {
53: throw new RuntimeException();
54: }
55:
56: return serializableClass;
57: }
58:
59: public SerializableClassWithTransientField echo(
60: SerializableClassWithTransientField serializableClass) {
61: if (!InheritanceTestSetValidator.isValid(serializableClass)) {
62: throw new RuntimeException();
63: }
64:
65: // this should not be sent back across the wire, the client will verify
66: // that this is true
67: serializableClass.setObj("hello");
68:
69: return serializableClass;
70: }
71:
72: public void foo() {
73: }
74:
75: public AbstractClass getAbstractClass() {
76: // never actually called, used in testing the RPC generator
77: return null;
78: }
79:
80: public MySerializableInterface getSerializableInterface1() {
81: // never actually called, used in testing the RPC generator
82: return null;
83: }
84:
85: public MySerializableInterface getSerializableInterface2() {
86: // never actually called, used in testing the RPC generator
87: return null;
88: }
89:
90: public SerializableClass getUnserializableClass() {
91: return InheritanceTestSetFactory.createNonStaticInnerClass();
92: }
93: }
|