Package eu.bandm.tools.lexic
Class Formats
java.lang.Object
eu.bandm.tools.lexic.Formats
This class contains only static factories for pretty-printable
representations of collections. It cannot be instantiated.
- See Also:
-
Method Summary
Modifier and TypeMethodDescription(package private) static <A,F> F collectionFormat(FormatServer<F> server, @Opt Collection<A> collection, Function<? super A, ? extends F> onElem, F open, F close) Returns a pretty-printable representation of a collection.(package private) static <K,V, F> F entryFormat(FormatServer<F> server, Map.Entry<K, V> entry, Function<? super K, ? extends F> onKey, Function<? super V, ? extends F> onValue) Returns a pretty-printable representation of a map entry.(package private) static <F> FlistFormat(FormatServer<F> server, @Opt List<?> list) Returns a pretty-printable representation of a list.(package private) static <A,F> F listFormat(FormatServer<F> server, @Opt List<A> list, Function<? super A, ? extends F> onElem) Returns a pretty-printable representation of a list.(package private) static <K,V, F> F mapFormat(FormatServer<F> server, @Opt Map<K, V> map) Returns a pretty-printable representation of a map.(package private) static <K,V, F> F mapFormat(FormatServer<F> server, @Opt Map<K, V> map, Function<? super K, ? extends F> onKey, Function<? super V, ? extends F> onValue) Returns a pretty-printable representation of a map.(package private) static <F> FsetFormat(FormatServer<F> server, @Opt Set<?> set) Returns a pretty-printable representation of a set.(package private) static <A,F> F setFormat(FormatServer<F> server, @Opt Set<A> set, Function<? super A, ? extends F> onElem) Returns a pretty-printable representation of a set.
-
Method Details
-
setFormat
Returns a pretty-printable representation of a set.The default representation of elements via
FormatServer.format(java.lang.Object)is used.- Type Parameters:
F- the type of format objects to produce- Parameters:
server- a factory object that can produce format objectsset- the set, ornull- Returns:
- a pretty-printable representation of the given set, or the
formatted literal
null
-
setFormat
static <A,F> F setFormat(FormatServer<F> server, @Opt @Opt Set<A> set, Function<? super A, ? extends F> onElem) Returns a pretty-printable representation of a set.- Type Parameters:
A- the type of elementsF- the type of format objects to produce- Parameters:
server- a factory object that can produce format objectsset- the set, ornullonElem- the function for computing representations of elements- Returns:
- a pretty-printable representation of the given set, or the
formatted literal
null
-
listFormat
Returns a pretty-printable representation of a list.The default representation of elements via
FormatServer.format(java.lang.Object)is used.- Type Parameters:
F- the type of format objects to produce- Parameters:
server- a factory object that can produce format objectslist- the list, ornull- Returns:
- a pretty-printable representation of the given list, or the
formatted literal
null
-
listFormat
static <A,F> F listFormat(FormatServer<F> server, @Opt @Opt List<A> list, Function<? super A, ? extends F> onElem) Returns a pretty-printable representation of a list.- Type Parameters:
A- the type of elementsF- the type of format objects to produce- Parameters:
server- a factory object that can produce format objectslist- the list, ornullonElem- the function for computing representations of elements- Returns:
- a pretty-printable representation of the given list, or the
formatted literal
null
-
collectionFormat
static <A,F> F collectionFormat(FormatServer<F> server, @Opt @Opt Collection<A> collection, Function<? super A, ? extends F> onElem, F open, F close) Returns a pretty-printable representation of a collection.- Type Parameters:
A- the type of elementsF- the type of format objects to produce- Parameters:
server- a factory object that can produce format objectscollection- the collection, ornullonElem- the function for computing representations of elementsopen- the opening bracketclose- the closing bracket- Returns:
- a pretty-printable representation of the given list, or the
formatted literal
null
-
mapFormat
Returns a pretty-printable representation of a map.The default representation of keys and values via
FormatServer.format(java.lang.Object)is used.- Type Parameters:
K- the type of keysV- the type of valuesF- the type of format objects to produce- Parameters:
server- a factory object that can produce format objectsmap- the map, ornull- Returns:
- a pretty-printable representation of the given map, or the
formatted literal
null
-
mapFormat
static <K,V, F mapFormatF> (FormatServer<F> server, @Opt @Opt Map<K, V> map, Function<? super K, ? extends F> onKey, Function<? super V, ? extends F> onValue) Returns a pretty-printable representation of a map.- Type Parameters:
K- the type of keysV- the type of valuesF- the type of format objects to produce- Parameters:
server- a factory object that can produce format objectsmap- the map, ornullonKey- the function for computing representations of keysonValue- the function for computing representations of values- Returns:
- a pretty-printable representation of the given map, or the
formatted literal
null
-
entryFormat
static <K,V, F entryFormatF> (FormatServer<F> server, Map.Entry<K, V> entry, Function<? super K, ? extends F> onKey, Function<? super V, ? extends F> onValue) Returns a pretty-printable representation of a map entry.- Type Parameters:
K- the type of keysV- the type of valuesF- the type of format objects to produce- Parameters:
server- a factory object that can produce format objectsentry- the map entryonKey- the function for computing representations of keysonValue- the function for computing representations of values- Returns:
- a pretty-printable representation of the given map entry
-