- All Known Implementing Classes:
Convertor.FormConvertor
public interface Convertor
An interface for message conversion, handling serialization and deserialization of objects to and from different data
formats.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classA form converter that can be used to automatically serialize form parameters. -
Method Summary
Modifier and TypeMethodDescriptionReturns the media type of the messages handled by this converter.byte[]Serializes a Java object into a byte array with a specified date format.byte[]Serializes a Java object into a byte array.toArray(InputStream in, Charset charset) Parses an input stream into aCoverArray.<T> TtoBean(Class<T> type, InputStream in, Charset charset) Parses an input stream into a Java bean of the specified type.<T> List<T> toList(Class<T> type, InputStream in, Charset charset) Parses an input stream into a list of Java objects of the specified type.toMapper(InputStream in, Charset charset) Parses an input stream into aCoverWapper.
-
Method Details
-
contentType
String contentType()Returns the media type of the messages handled by this converter.- Returns:
- The media type string.
-
toMapper
Parses an input stream into aCoverWapper.- Parameters:
in- The input stream.charset- The character set.- Returns:
- A
CoverWapperinstance.
-
toArray
Parses an input stream into aCoverArray.- Parameters:
in- The input stream.charset- The character set.- Returns:
- A
CoverArrayinstance.
-
serialize
Serializes a Java object into a byte array.- Parameters:
object- The Java object.charset- The character set.- Returns:
- A byte array.
-
serialize
Serializes a Java object into a byte array with a specified date format.- Parameters:
object- The Java object.dateFormat- The date format string.charset- The character set.- Returns:
- A byte array.
-
toBean
Parses an input stream into a Java bean of the specified type.- Type Parameters:
T- The target generic type.- Parameters:
type- The target class type.in- The input stream.charset- The character set.- Returns:
- A Java bean instance.
-
toList
Parses an input stream into a list of Java objects of the specified type.- Type Parameters:
T- The target generic type.- Parameters:
type- The target class type.in- The input stream.charset- The character set.- Returns:
- A list of Java objects.
-