com.highdeal.pnr.hci
Class StatelessContextSerializer

java.lang.Object
  extended by com.highdeal.pnr.hci.StatelessContextSerializer

public class StatelessContextSerializer
extends java.lang.Object

This class provides methods for the serialization and unserialization of the StatelessRatingContext and StatelessPreRatingContext.

Objects are serialized (unserialized) to (from) byte arrays. What is done with these byte arrays is the reponsibility of the integration code.

The format of the byte arrays is:

In case of compressed data, the used algorithm is the ZLIB compression provided by Deflater and Inflater.


Field Summary
static byte COMPRESSED
          Flag for compressed data
static byte NOT_COMPRESSED
          Flag for not compressed data
static byte VERSION
          Flag indicating the version
 
Method Summary
static StatelessContextSerializer getInstance()
          Returns the singleton instance for this class.
 StatelessPreRatingContext readStatelessPreRatingContext(byte[] bytes)
          Unserializes a byte array to a StatelessPreRatingContext.
 StatelessRatingContext readStatelessRatingContext(byte[] bytes)
          Unserializes a byte array to a StatelessRatingContext.
 java.lang.String toString()
          Returns a string representation of this object.
 byte[] writeStatelessPreRatingContext(StatelessPreRatingContext preRatingContext, boolean compress)
          Serializes the given StatelessPreRatingContext into a new allocated byte array.
 byte[] writeStatelessRatingContext(StatelessRatingContext ratingContext, boolean compress)
          Serializes the given StatelessRatingContext into a new allocated byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VERSION

public static final byte VERSION
Flag indicating the version

See Also:
Constant Field Values

NOT_COMPRESSED

public static final byte NOT_COMPRESSED
Flag for not compressed data

See Also:
Constant Field Values

COMPRESSED

public static final byte COMPRESSED
Flag for compressed data

See Also:
Constant Field Values
Method Detail

getInstance

public static StatelessContextSerializer getInstance()
Returns the singleton instance for this class.

Returns:
The singleton instance for this class

writeStatelessRatingContext

public byte[] writeStatelessRatingContext(StatelessRatingContext ratingContext,
                                          boolean compress)
                                   throws StatelessContextSerializationException
Serializes the given StatelessRatingContext into a new allocated byte array.

Parameters:
ratingContext - The StatelessRatingContext to serialize
compress - The flag to indicate whether serialized data should be compressed ot not
Returns:
A byte array containing the serialized ratinContext
Throws:
StatelessContextSerializationException

readStatelessRatingContext

public StatelessRatingContext readStatelessRatingContext(byte[] bytes)
                                                  throws StatelessContextSerializationException
Unserializes a byte array to a StatelessRatingContext.

Parameters:
bytes - The bytes to unserialize
Returns:
A newly allocated StatelessRatingContext built from the given bytes
Throws:
StatelessContextSerializationException

writeStatelessPreRatingContext

public byte[] writeStatelessPreRatingContext(StatelessPreRatingContext preRatingContext,
                                             boolean compress)
                                      throws StatelessContextSerializationException
Serializes the given StatelessPreRatingContext into a new allocated byte array.

Parameters:
preRatingContext - The StatelessPreRatingContext to serialize
compress - The flag to indicate whether serialized data should be compressed ot not
Returns:
A byte array containing the serialized preRatingContext
Throws:
StatelessContextSerializationException

readStatelessPreRatingContext

public StatelessPreRatingContext readStatelessPreRatingContext(byte[] bytes)
                                                        throws StatelessContextSerializationException
Unserializes a byte array to a StatelessPreRatingContext.

Parameters:
bytes - The bytes to unserialize
Returns:
A newly allocated StatelessPreRatingContext built from the given bytes
Throws:
StatelessContextSerializationException

toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this object

Document Published: October 2015 (SAP CC 4.0 SP10 and Later)