001: /*
002: * Copyright 2007 Google Inc.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005: * use this file except in compliance with the License. You may obtain a copy of
006: * the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013: * License for the specific language governing permissions and limitations under
014: * the License.
015: */
016: package com.google.gwt.user.server.rpc;
017:
018: import com.google.gwt.user.client.rpc.ValueTypesTestService;
019:
020: /**
021: * Server-side code for ValueTypesTest. Mostly just echoes back the values
022: * received from the client, but some methods verify the value received to
023: * make sure it isn't mangled on the way to the server and then unmangled
024: * on the way back to the client.
025: */
026: public class ValueTypesTestServiceImpl extends RemoteServiceServlet
027: implements ValueTypesTestService {
028:
029: public byte echo(byte value) {
030: return value;
031: }
032:
033: public char echo(char value) {
034: return value;
035: }
036:
037: public double echo(double value) {
038: return value;
039: }
040:
041: public float echo(float value) {
042: return value;
043: }
044:
045: public int echo(int value) {
046: return value;
047: }
048:
049: public long echo(long value) {
050: return value;
051: }
052:
053: public short echo(short value) {
054: return value;
055: }
056:
057: public boolean echo_FALSE(boolean value) {
058: if (value != false) {
059: throw new RuntimeException();
060: }
061:
062: return value;
063: }
064:
065: public byte echo_MAX_VALUE(byte value) {
066: if (value != Byte.MAX_VALUE) {
067: throw new RuntimeException();
068: }
069:
070: return value;
071: }
072:
073: public char echo_MAX_VALUE(char value) {
074: if (value != Character.MAX_VALUE) {
075: throw new RuntimeException();
076: }
077:
078: return value;
079: }
080:
081: public double echo_MAX_VALUE(double value) {
082: if (value != Double.MAX_VALUE) {
083: throw new RuntimeException();
084: }
085:
086: return value;
087: }
088:
089: public float echo_MAX_VALUE(float value) {
090: if (value != Float.MAX_VALUE) {
091: throw new RuntimeException();
092: }
093:
094: return value;
095: }
096:
097: public int echo_MAX_VALUE(int value) {
098: if (value != Integer.MAX_VALUE) {
099: throw new RuntimeException();
100: }
101:
102: return value;
103: }
104:
105: public long echo_MAX_VALUE(long value) {
106: if (value != Long.MAX_VALUE) {
107: throw new RuntimeException("expected: "
108: + Long.toString(Long.MAX_VALUE) + " actual: "
109: + Long.toString(value));
110: }
111:
112: return value;
113: }
114:
115: public short echo_MAX_VALUE(short value) {
116: if (value != Short.MAX_VALUE) {
117: throw new RuntimeException();
118: }
119:
120: return value;
121: }
122:
123: public byte echo_MIN_VALUE(byte value) {
124: if (value != Byte.MIN_VALUE) {
125: throw new RuntimeException();
126: }
127:
128: return value;
129: }
130:
131: public char echo_MIN_VALUE(char value) {
132: if (value != Character.MIN_VALUE) {
133: throw new RuntimeException();
134: }
135:
136: return value;
137: }
138:
139: public double echo_MIN_VALUE(double value) {
140: if (value != Double.MIN_VALUE) {
141: throw new RuntimeException();
142: }
143:
144: return value;
145: }
146:
147: public float echo_MIN_VALUE(float value) {
148: if (value != Float.MIN_VALUE) {
149: throw new RuntimeException();
150: }
151:
152: return value;
153: }
154:
155: public int echo_MIN_VALUE(int value) {
156: if (value != Integer.MIN_VALUE) {
157: throw new RuntimeException();
158: }
159:
160: return value;
161: }
162:
163: public long echo_MIN_VALUE(long value) {
164: if (value != Long.MIN_VALUE) {
165: throw new RuntimeException("expected: "
166: + Long.toString(Long.MIN_VALUE) + " actual: "
167: + Long.toString(value));
168: }
169:
170: return value;
171: }
172:
173: public short echo_MIN_VALUE(short value) {
174: if (value != Short.MIN_VALUE) {
175: throw new RuntimeException();
176: }
177:
178: return value;
179: }
180:
181: public boolean echo_TRUE(boolean value) {
182: if (value != true) {
183: throw new RuntimeException();
184: }
185:
186: return value;
187: }
188: }
|