PageRenderTime 18ms CodeModel.GetById 9ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/src/com/google/appengine/datanucleus/SerializationStrategy.java

http://datanucleus-appengine.googlecode.com/
Java | 45 lines | 6 code | 4 blank | 35 comment | 0 complexity | af0952af1a69b4514511fe86b4ae1521 MD5 | raw file
 1/**********************************************************************
 2Copyright (c) 2009 Google Inc.
 3
 4Licensed under the Apache License, Version 2.0 (the "License");
 5you may not use this file except in compliance with the License.
 6You may obtain a copy of the License at
 7
 8http://www.apache.org/licenses/LICENSE-2.0
 9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15**********************************************************************/
16package com.google.appengine.datanucleus;
17
18import com.google.appengine.api.datastore.Blob;
19
20/**
21 * A strategy for serializing objects to the datastore.
22 *
23 * This class is part of the public interface of the DataNucleus App Engine
24 * Plugin and can be safely referenced in user code.
25 *
26 * @author Max Ross <maxr@google.com>
27 */
28public interface SerializationStrategy {
29
30  /**
31   * Transforms the given object into a {@link Blob}.
32   * @param obj The object to be transformed.
33   * @return The {@link Blob} representation of the given object.
34   */
35  Blob serialize(Object obj);
36
37  /**
38   * Transforms the given blob into an object of the given class.
39   * @param blob The blob to be transformed.
40   * @param targetClass The class of the object into which the blob should be
41   * transformed.
42   * @return The <code>targetClass</code> representation of the given blob.
43   */
44  Object deserialize(Blob blob, Class<?> targetClass);
45}