Top Description Constructors Methods
org.glassfish.tyrus.core.coder

public Class ToStringEncoder

extends CoderAdapter
implements Encoder.Text<Object>
Class Inheritance
All Implemented Interfaces
jakarta.websocket.Encoder.Text, jakarta.websocket.Encoder
Imports
jakarta.websocket.EncodeException, .Encoder

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

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
encode(Object
the object being encoded.
object
)

Implements jakarta.websocket.Encoder.Text.encode.

Encode the given object into a String.

Inherited from org.glassfish.tyrus.core.coder.CoderAdapter:
destroyinit

Constructor Detail

ToStringEncoderback to summary
public ToStringEncoder()

Method Detail

encodeback to summary
public String encode(Object object) throws EncodeException

Implements jakarta.websocket.Encoder.Text.encode.

Doc from jakarta.websocket.Encoder.Text.encode.

Encode the given object into a String.

Parameters
object:Object

the object being encoded.

Returns:String

the encoded object as a string.

Annotations
@Override
Exceptions
EncodeException:
The provided object could not be encoded as a string