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: import com.google.gwt.user.client.rpc.InheritanceTestSetFactory.SerializableClass;
19: import com.google.gwt.user.client.rpc.InheritanceTestSetFactory.SerializableClassWithTransientField;
20: import com.google.gwt.user.client.rpc.InheritanceTestSetFactory.SerializableSubclass;
21:
22: /**
23: * TODO: document me.
24: */
25: public class InheritanceTestSetValidator {
26: public static boolean isValid(SerializableClass serializableClass) {
27: if (serializableClass == null) {
28: return false;
29: }
30:
31: return serializableClass.getA() == 1
32: && serializableClass.getB() == 2
33: && serializableClass.getC() == 3
34: && serializableClass.d == 4 && serializableClass.e == 5;
35: }
36:
37: public static boolean isValid(
38: SerializableClassWithTransientField cls) {
39: if (cls == null) {
40: return false;
41: }
42:
43: if (!isValid((SerializableClass) cls)) {
44: return false;
45: }
46:
47: if (cls.getObj() != null) {
48: return false;
49: }
50:
51: return true;
52: }
53:
54: public static boolean isValid(
55: SerializableSubclass serializableSubclass) {
56: if (serializableSubclass == null) {
57: return false;
58: }
59:
60: if (serializableSubclass.getD() != 4) {
61: return false;
62: }
63:
64: return isValid((SerializableClass) serializableSubclass);
65: }
66: }
|