org.glassfish.tyrus
Class ToStringEncoder

java.lang.Object
  extended by org.glassfish.tyrus.ToStringEncoder
All Implemented Interfaces:
Encoder, Encoder.Text<Object>

public class ToStringEncoder
extends Object
implements Encoder.Text<Object>

Fall-back encoder - encoders any object to string using Object.toString() method.

Author:
Martin Matula (martin.matula at oracle.com)

Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.websocket.Encoder
Encoder.Binary<T>, Encoder.BinaryStream<T>, Encoder.Text<T>, Encoder.TextStream<T>
 
Field Summary
static ToStringEncoder INSTANCE
           
 
Constructor Summary
ToStringEncoder()
           
 
Method Summary
 String encode(Object object)
          Encode the given object into a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static ToStringEncoder INSTANCE
Constructor Detail

ToStringEncoder

public ToStringEncoder()
Method Detail

encode

public String encode(Object object)
              throws EncodeException
Description copied from interface: Encoder.Text
Encode the given object into a String.

Specified by:
encode in interface Encoder.Text<Object>
Parameters:
object - the object being encoded.
Returns:
the encoded object as a string.
Throws:
EncodeException


Copyright © 2012. All Rights Reserved.