Skip navigation links

Oracle® Fusion Middleware Java API Reference for Oracle Coherence
12c (12.1.3.0.0)

E47890-01


com.tangosol.coherence.rest.io
Class KeyConverterAdapter

java.lang.Object
  extended by com.tangosol.coherence.rest.io.KeyConverterAdapter

All Implemented Interfaces:
Marshaller

public class KeyConverterAdapter
extends java.lang.Object
implements Marshaller

Marshaller that marshalls objects using a cache's key converter.

Author:
vp 2011.07.26

Field Summary

 

Fields inherited from interface com.tangosol.coherence.rest.io.Marshaller
FORMAT_OUTPUT

 

Constructor Summary
KeyConverterAdapter(KeyConverter converter)
          Construct KeyConverterAdapter instance.

 

Method Summary
 void marshal(java.lang.Object oValue, java.io.OutputStream out)
          Write the specified object into the given stream.
 void marshalAsFragment(java.lang.Object oValue, java.io.OutputStream out)
          Write the specified object into the given stream as a fragment.
 java.lang.Object unmarshal(java.io.InputStream in)
          Read an object from the specified stream.

 

Constructor Detail

KeyConverterAdapter

public KeyConverterAdapter(KeyConverter converter)
Construct KeyConverterAdapter instance.
Parameters:
converter - key converter used to marshall key objects

Method Detail

marshal

public void marshal(java.lang.Object oValue,
                    java.io.OutputStream out)
             throws java.io.IOException
Write the specified object into the given stream.
Specified by:
marshal in interface Marshaller
Parameters:
oValue - object to marshall
out - stream to write to
Throws:
java.io.IOException - if an error occurs during marshalling

marshalAsFragment

public void marshalAsFragment(java.lang.Object oValue,
                              java.io.OutputStream out)
                       throws java.io.IOException
Write the specified object into the given stream as a fragment.

This method is called when marshalling collections of objects, as marshalling behavior might differ when an object is serialized directly or as element of a collection.

For example, when marshalling a collection of objects into XML, you need to ensure that the XML declaration is emmitted only once, not for each object in the collection.

In cases where there is no difference in output between fragments and full objects (JSON, for example), this method could simply delegate to Marshaller.marshal(Object, OutputStream).

Specified by:
marshalAsFragment in interface Marshaller
Parameters:
oValue - object to marshall
out - stream to write to
Throws:
java.io.IOException - if an error occurs during marshalling

unmarshal

public java.lang.Object unmarshal(java.io.InputStream in)
                           throws java.io.IOException
Read an object from the specified stream.
Specified by:
unmarshal in interface Marshaller
Parameters:
in - stream to read from
Returns:
unmarshalled object instance
Throws:
java.io.IOException - if an error occurs during unmarshalling

Skip navigation links

Oracle® Fusion Middleware Java API Reference for Oracle Coherence
12c (12.1.3.0.0)

E47890-01


Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.