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.client.rpc;
17:
18: /**
19: * RemoteService used to test the use of enums over RPC.
20: */
21: public interface EnumsTestService extends RemoteService {
22: /**
23: * Exception thrown when the enumeration state from the client makes it to the
24: * server.
25: */
26: public class EnumStateModificationException extends
27: SerializableException {
28: public EnumStateModificationException() {
29: }
30:
31: public EnumStateModificationException(String msg) {
32: super (msg);
33: }
34: }
35:
36: /**
37: * Simplest enum possible; no subtypes or enum constant specific state.
38: */
39: public enum Basic {
40: A, B, C
41: }
42:
43: /**
44: * Enum that has no default constructor and includes state.
45: */
46: public enum Complex {
47: A("X"), B("Y"), C("Z");
48:
49: public String value;
50:
51: Complex(String value) {
52: this .value = value;
53: }
54:
55: public String value() {
56: return value;
57: }
58: }
59:
60: /**
61: * Enum that has local subtypes.
62: */
63: public enum Subclassing {
64: A {
65: @Override
66: public String value() {
67: return "X";
68: }
69: },
70: B {
71: @Override
72: public String value() {
73: return "Y";
74: }
75: },
76: C {
77: @Override
78: public String value() {
79: return "Z";
80: }
81: };
82:
83: public abstract String value();
84: }
85:
86: Basic echo(Basic value);
87:
88: Complex echo(Complex value) throws EnumStateModificationException;
89:
90: Subclassing echo(Subclassing value);
91: }
|