public interface Serializer
Supports writing and reading of object instances to/from a pipe.
-
Method Summary
Modifier and TypeMethodDescriptiondefault SerializerAdapts this serializer to conform to the given descriptor or else returns this instance if no adaptation is required.default ObjectReturns an opaque serializable object describing the encoding format.Reads an object from the pipe.static SerializerGenerates and returns a serializer for a record type, an enum type, or a simple class.Returns a non-null set of classes.voidWrites a non-null object to the pipe.
-
Method Details
-
simple
Generates and returns a serializer for a record type, an enum type, or a simple class. A simple class must have a public no-arg constructor, and only public fields are serialized. Static and transient fields aren't serialized either.- Throws:
IllegalArgumentException- if the given type isn't supported
-
supportedTypes
Returns a non-null set of classes. -
write
Writes a non-null object to the pipe.- Throws:
IOException
-
read
Reads an object from the pipe. The returned object can be null.- Throws:
IOException
-
descriptor
Returns an opaque serializable object describing the encoding format. The descriptor type itself can only depend on built-in serializers and is typically a string. -
adapt
Adapts this serializer to conform to the given descriptor or else returns this instance if no adaptation is required. If adaptation isn't possible, can return null to specify a serializer which always reads and writes null, thus discarding the object entirely.- Parameters:
descriptor- an object which was provided by thedescriptor()method
-