public enum Printables extends Enum<Printables>
An entry point class that provides methods to create a new "printable" function from a given conventional function.
Modifier and Type | Method and Description |
---|---|
static <T,R> Function<T,R> |
function(String name,
Function<T,R> function)
Returns a printable function for a given one.
|
static <T,R> Function<T,R> |
function(Supplier<String> formatter,
Function<T,R> function)
Returns a printable function for a given one.
|
static <T> Predicate<T> |
predicate(String name,
Predicate<T> predicate)
Returns a printable predicate for a given one.
|
static <T> Predicate<T> |
predicate(Supplier<String> formatter,
Predicate<T> predicate)
Returns a printable predicate for a given one.
|
static Printables |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Printables[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static Printables[] values()
for (Printables c : Printables.values()) System.out.println(c);
public static Printables valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static <T> Predicate<T> predicate(String name, Predicate<T> predicate)
Returns a printable predicate for a given one.
This is a short hand of Printables.predicate(() → name, predicate)
.
T
- The type that the returned predicate can test.name
- A name of the returned predicate.predicate
- A predicate from which a printable predicate is created.public static <T> Predicate<T> predicate(Supplier<String> formatter, Predicate<T> predicate)
Returns a printable predicate for a given one.
T
- The type that the returned predicate can test.formatter
- A supplier that gives a string printed on toString()
.predicate
- A predicate from which a printable predicate is created.public static <T,R> Function<T,R> function(String name, Function<T,R> function)
Returns a printable function for a given one.
This is a short-hand method for Printables.function(() → name, function)
.
T
- A type of the function’s parameter.R
- A type of the function’s returned value.name
- A name of the function.function
- A function from which a printable function is created.public static <T,R> Function<T,R> function(Supplier<String> formatter, Function<T,R> function)
Returns a printable function for a given one.
T
- A type of the function’s parameter.R
- A type of the function’s returned value.formatter
- A supplier that gives a string printed on toString()
.function
- A function from which a printable function is created.Copyright © 2024. All rights reserved.