Package com.backblaze.b2.json
Class B2JsonCharSquenceHandler
- java.lang.Object
-
- com.backblaze.b2.json.B2JsonCharSquenceHandler
-
- All Implemented Interfaces:
B2JsonTypeHandler<java.lang.CharSequence>
public class B2JsonCharSquenceHandler extends java.lang.Object implements B2JsonTypeHandler<java.lang.CharSequence>
(De)serializes CharSequence objects When deserializing, the underlying concrete type is String and thus will allocate even when the JSON input is a string.
-
-
Constructor Summary
Constructors Constructor Description B2JsonCharSquenceHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.CharSequencedefaultValueForOptional()Returns the default value to use when an optional field is not present.java.lang.CharSequencedeserialize(B2JsonReader in, B2JsonOptions options)Deserialize one object from a JSON input stream.java.lang.CharSequencedeserializeUrlParam(java.lang.String urlValue)When an API is called with GET, this is used to deserialize one of the values.java.lang.reflect.TypegetHandledType()What class does this handle?booleanisStringInJson()Does this type look like a string in JSON?voidserialize(java.lang.CharSequence obj, B2JsonOptions options, B2JsonWriter out)Serialize one object of the class to a JSON output stream.
-
-
-
Method Detail
-
getHandledType
public java.lang.reflect.Type getHandledType()
Description copied from interface:B2JsonTypeHandlerWhat class does this handle?- Specified by:
getHandledTypein interfaceB2JsonTypeHandler<java.lang.CharSequence>- Returns:
-
serialize
public void serialize(java.lang.CharSequence obj, B2JsonOptions options, B2JsonWriter out) throws java.io.IOException, B2JsonExceptionDescription copied from interface:B2JsonTypeHandlerSerialize one object of the class to a JSON output stream. The object is guaranteed not to be null.- Specified by:
serializein interfaceB2JsonTypeHandler<java.lang.CharSequence>- Throws:
java.io.IOExceptionB2JsonException
-
deserialize
public java.lang.CharSequence deserialize(B2JsonReader in, B2JsonOptions options) throws B2JsonException, java.io.IOException
Description copied from interface:B2JsonTypeHandlerDeserialize one object from a JSON input stream. Will never be called when there is "null" in the input stream, and will never return null.- Specified by:
deserializein interfaceB2JsonTypeHandler<java.lang.CharSequence>- Throws:
B2JsonExceptionjava.io.IOException
-
deserializeUrlParam
public java.lang.CharSequence deserializeUrlParam(java.lang.String urlValue) throws B2JsonExceptionDescription copied from interface:B2JsonTypeHandlerWhen an API is called with GET, this is used to deserialize one of the values.- Specified by:
deserializeUrlParamin interfaceB2JsonTypeHandler<java.lang.CharSequence>- Throws:
B2JsonException
-
defaultValueForOptional
public java.lang.CharSequence defaultValueForOptional()
Description copied from interface:B2JsonTypeHandlerReturns the default value to use when an optional field is not present.- Specified by:
defaultValueForOptionalin interfaceB2JsonTypeHandler<java.lang.CharSequence>
-
isStringInJson
public boolean isStringInJson()
Description copied from interface:B2JsonTypeHandlerDoes this type look like a string in JSON?- Specified by:
isStringInJsonin interfaceB2JsonTypeHandler<java.lang.CharSequence>
-
-