Package io.micronaut.serde.support.util
Class JsonNodeEncoder
java.lang.Object
io.micronaut.serde.support.util.JsonNodeEncoder
- All Implemented Interfaces:
Encoder,AutoCloseable
Implementation of the
Encoder interface that encodes a
in-memory JsonNode.-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull JsonNodeEncodercreate()Creates a new instance.encodeArray(io.micronaut.core.type.Argument<?> type) Encodes an array.voidencodeBigDecimal(BigDecimal value) Encode a BigDecimal.voidencodeBigInteger(BigInteger value) Encode a BigInteger.voidencodeBoolean(boolean value) Encode a boolean.voidencodeByte(byte value) Encode a byte.voidencodeChar(char value) Encode a char.voidencodeDouble(double value) Encode a double.voidencodeFloat(float value) Encode a float.voidencodeInt(int value) Encode an int.voidencodeLong(long value) Encode a long.voidEncodenull.encodeObject(io.micronaut.core.type.Argument<?> type) Encodes an object.voidencodeShort(short value) Encode a short.voidencodeString(String value) Encode a string.protected abstract voidencodeValue(io.micronaut.json.tree.JsonNode node) Encode the given value.@NonNull io.micronaut.json.tree.JsonNodeObtains the completed value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.serde.Encoder
close, currentPath, encodeKey, finishStructure
-
Method Details
-
create
Creates a new instance.- Returns:
- The
JsonNodeEncoder
-
encodeValue
protected abstract void encodeValue(io.micronaut.json.tree.JsonNode node) Encode the given value.- Parameters:
node- The node to encode
-
encodeString
Description copied from interface:EncoderEncode a string.- Specified by:
encodeStringin interfaceEncoder- Parameters:
value- The string, nevernull
-
encodeBoolean
public void encodeBoolean(boolean value) Description copied from interface:EncoderEncode a boolean.- Specified by:
encodeBooleanin interfaceEncoder- Parameters:
value- The boolean
-
encodeByte
public void encodeByte(byte value) Description copied from interface:EncoderEncode a byte.- Specified by:
encodeBytein interfaceEncoder- Parameters:
value- The byte
-
encodeShort
public void encodeShort(short value) Description copied from interface:EncoderEncode a short.- Specified by:
encodeShortin interfaceEncoder- Parameters:
value- The short
-
encodeChar
public void encodeChar(char value) Description copied from interface:EncoderEncode a char.- Specified by:
encodeCharin interfaceEncoder- Parameters:
value- The char
-
encodeInt
public void encodeInt(int value) Description copied from interface:EncoderEncode an int. -
encodeLong
public void encodeLong(long value) Description copied from interface:EncoderEncode a long.- Specified by:
encodeLongin interfaceEncoder- Parameters:
value- The long
-
encodeFloat
public void encodeFloat(float value) Description copied from interface:EncoderEncode a float.- Specified by:
encodeFloatin interfaceEncoder- Parameters:
value- The float
-
encodeDouble
public void encodeDouble(double value) Description copied from interface:EncoderEncode a double.- Specified by:
encodeDoublein interfaceEncoder- Parameters:
value- The double
-
encodeBigInteger
Description copied from interface:EncoderEncode a BigInteger.- Specified by:
encodeBigIntegerin interfaceEncoder- Parameters:
value- The BigInteger, nevernull
-
encodeBigDecimal
Description copied from interface:EncoderEncode a BigDecimal.- Specified by:
encodeBigDecimalin interfaceEncoder- Parameters:
value- The BigDecimal, nevernull
-
encodeNull
public void encodeNull()Description copied from interface:EncoderEncodenull.- Specified by:
encodeNullin interfaceEncoder
-
encodeArray
Description copied from interface:EncoderEncodes an array.- Specified by:
encodeArrayin interfaceEncoder- Parameters:
type- The array type, nevernull- Returns:
- The encoder, never
null
-
encodeObject
Description copied from interface:EncoderEncodes an object.- Specified by:
encodeObjectin interfaceEncoder- Parameters:
type- The object type, nevernull- Returns:
- The encoder, never
null
-
getCompletedValue
@NonNull public @NonNull io.micronaut.json.tree.JsonNode getCompletedValue()Obtains the completed value.- Returns:
- The materialized
JsonNode
-