Interface Parsable<I>
-
- Type Parameters:
I- type of resource content
- All Known Implementing Classes:
ResourceAsByteArray,ResourceAsInputStream,ResourceAsReader,ResourceAsText
public interface Parsable<I>Interface of resource builder that can parse content of resource file.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Iget()default <O> Oparse(java.util.function.Function<I,O> parsingFunction)Parses content of resource usingparsingFunction.default <O> OparseChecked(ThrowingFunction<I,O> parsingFunction)Parses content of resource usingparsingFunctionthat may throw exception.default voidthen(java.util.function.Consumer<I> contentConsumer)Processes content of resource usingcontentConsumer.default voidthenChecked(ThrowingConsumer<I> contentConsumer)Processes content of resource usingcontentConsumerthat may throw exception.
-
-
-
Method Detail
-
get
I get()
- Returns:
- content of resource as type
T.
-
parse
default <O> O parse(java.util.function.Function<I,O> parsingFunction)
Parses content of resource usingparsingFunction.- Type Parameters:
O- type of parsed content- Parameters:
parsingFunction- parsing function- Returns:
- parsed resource content
-
parseChecked
default <O> O parseChecked(ThrowingFunction<I,O> parsingFunction)
Parses content of resource usingparsingFunctionthat may throw exception.Function converts all thrown checked exceptions to unchecked
RuntimeException.- Type Parameters:
O- type of parsed content- Parameters:
parsingFunction- parsing function that may throw exception- Returns:
- parsed resource content
-
then
default void then(java.util.function.Consumer<I> contentConsumer)
Processes content of resource usingcontentConsumer.- Parameters:
contentConsumer- content consumer
-
thenChecked
default void thenChecked(ThrowingConsumer<I> contentConsumer)
Processes content of resource usingcontentConsumerthat may throw exception.- Parameters:
contentConsumer- content consumer that may throw exception
-
-