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 void
close()
Finalize the current structure.default String
Return an analysis of the current path.encodeArray
(io.micronaut.core.type.Argument<?> type) Encodes an array.void
encodeBigDecimal
(BigDecimal value) Encode a BigDecimal.void
encodeBigInteger
(BigInteger value) Encode a BigInteger.void
encodeBoolean
(boolean value) Encode a boolean.void
encodeByte
(byte value) Encode a byte.void
encodeChar
(char value) Encode a char.void
encodeDouble
(double value) Encode a double.void
encodeFloat
(float value) Encode a float.void
encodeInt
(int value) Encode an int.void
Encode a key.void
encodeLong
(long value) Encode a long.void
Encodenull
.encodeObject
(io.micronaut.core.type.Argument<?> type) Encodes an object.void
encodeShort
(short value) Encode a short.void
encodeString
(String value) Encode a string.void
Finalize 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:
close
in 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
-