Interface Formatter<T>
- Type Parameters:
T- the formatted type
- All Known Subinterfaces:
Formatter.Identity
- All Known Implementing Classes:
Formatter.Provided
public interface Formatter<T>
Formats an objects into a string representation and back again.
- Author:
- Paul Ferraro
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic class -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionFormats the specified key to a string representation.The implementation class of the target key of this format.static <T> Formatter<T> of(T value) Parses the key from the specified string.static <T> Formatter<T> serialized(Class<T> targetClass, Serializer<T> serializer) default <U> Formatter<U> Returns a wrapped formatter.
-
Field Details
-
IDENTITY
-
-
Method Details
-
getTargetClass
The implementation class of the target key of this format.- Returns:
- an implementation class
-
parse
Parses the key from the specified string.- Parameters:
value- a string representation of the key- Returns:
- the parsed key
-
format
Formats the specified key to a string representation.- Parameters:
value- a key to format- Returns:
- a string representation of the specified key.
-
wrap
Returns a wrapped formatter.- Type Parameters:
U- the wrapped type- Parameters:
targetClass- the wrapped typewrapper- the wrapper functionunwrapper- the unwrapper function- Returns:
- a wrapped formmater
-
of
-
serialized
-