Package io.micronaut.serde
Interface Encoder
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
BsonWriterEncoder,JacksonEncoder,JsonNodeEncoder,OracleJdbcJsonGeneratorEncoder
Core interface for encoding a serialization format such as JSON.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()Finalize the current structure.default StringReturn an analysis of the current path.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.voidEncode a key.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.voidFinalize a previously created structure, like an array or object.
-
Method Details
-
encodeArray
Encodes an array.- Parameters:
type- The array type, nevernull- Returns:
- The encoder, never
null - Throws:
IOException- if an error occurs
-
encodeObject
Encodes an object.- Parameters:
type- The object type, nevernull- Returns:
- The encoder, never
null - Throws:
IOException- if an error occurs
-
finishStructure
Finalize a previously created structure, like an array or object.- Throws:
IOException- If an error occurs
-
close
Finalize the current structure. Equivalent to callingfinishStructure().- Specified by:
closein interfaceAutoCloseable- Throws:
IOException- If an unrecoverable error occurs
-
encodeKey
Encode a key.- Parameters:
key- The key, nevernull- Throws:
IOException- If an error occurs
-
encodeString
Encode a string.- Parameters:
value- The string, nevernull- Throws:
IOException- If an error occurs
-
encodeBoolean
Encode a boolean.- Parameters:
value- The boolean- Throws:
IOException- If an error occurs
-
encodeByte
Encode a byte.- Parameters:
value- The byte- Throws:
IOException- If an error occurs
-
encodeShort
Encode a short.- Parameters:
value- The short- Throws:
IOException- If an error occurs
-
encodeChar
Encode a char.- Parameters:
value- The char- Throws:
IOException- If an error occurs
-
encodeInt
Encode an int.- Parameters:
value- The int- Throws:
IOException- If an error occurs
-
encodeLong
Encode a long.- Parameters:
value- The long- Throws:
IOException- If an error occurs
-
encodeFloat
Encode a float.- Parameters:
value- The float- Throws:
IOException- If an error occurs
-
encodeDouble
Encode a double.- Parameters:
value- The double- Throws:
IOException- If an error occurs
-
encodeBigInteger
Encode a BigInteger.- Parameters:
value- The BigInteger, nevernull- Throws:
IOException- If an error occurs
-
encodeBigDecimal
Encode a BigDecimal.- Parameters:
value- The BigDecimal, nevernull- Throws:
IOException- If an error occurs
-
encodeNull
Encodenull.- Throws:
IOException- If an error occurs
-
currentPath
Return an analysis of the current path.- Returns:
- The current path if known
-