public class StringObject extends Object implements CharSequence, Writable
Useful in certain conditions such as logging when you don't want to needlessly serialize objects.
Instances of this method are created by the WriterSerializer.toStringObject(Object)
method.
Constructor and Description |
---|
StringObject(Object o)
Constructor with default serializer
SimpleJsonSerializer.DEFAULT |
StringObject(WriterSerializer s,
Object o)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
char |
charAt(int index) |
MediaType |
getMediaType()
Returns the serialized media type for this resource (e.g.
|
int |
length() |
CharSequence |
subSequence(int start,
int end) |
String |
toString() |
Writer |
writeTo(Writer w)
Serialize this object to the specified writer.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
chars, codePoints
public StringObject(WriterSerializer s, Object o)
s
- The serializer to use to serialize the object.o
- The object to be serialized.public StringObject(Object o)
SimpleJsonSerializer.DEFAULT
o
- The object to be serialized.public String toString()
toString
in interface CharSequence
toString
in class Object
public int length()
length
in interface CharSequence
public char charAt(int index)
charAt
in interface CharSequence
public CharSequence subSequence(int start, int end)
subSequence
in interface CharSequence
public Writer writeTo(Writer w) throws IOException
Writable
writeTo
in interface Writable
w
- The writer to write to.IOException
- Thrown by underlying stream.public MediaType getMediaType()
Writable
getMediaType
in interface Writable
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.