01: /*
02: * Copyright 2006 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.impl;
17:
18: import com.google.gwt.user.client.rpc.SerializationException;
19: import com.google.gwt.user.client.rpc.SerializationStreamReader;
20: import com.google.gwt.user.client.rpc.SerializationStreamWriter;
21:
22: /**
23: * Contract for any class that can serialize and restore class into a
24: * serialization stream.
25: */
26: public interface Serializer {
27:
28: /**
29: * Restore an instantiated object from the serialized stream.
30: */
31: void deserialize(SerializationStreamReader stream, Object instance,
32: String typeSignature) throws SerializationException;
33:
34: /**
35: * Return the serialization signature for the given type name.
36: */
37: String getSerializationSignature(String typeName);
38:
39: /**
40: * Instantiate an object of the given typeName from the serialized stream.
41: */
42: Object instantiate(SerializationStreamReader stream,
43: String typeSignature) throws SerializationException;
44:
45: /**
46: * Save an instance into the serialization stream.
47: */
48: void serialize(SerializationStreamWriter stream, Object instance,
49: String typeSignature) throws SerializationException;
50: }
|