Multiverse-Core/src/main/java/org/mvplugins/multiverse/core/configuration/functions/NodeStringParser.java

23 lines
739 B
Java

package org.mvplugins.multiverse.core.configuration.functions;
import io.vavr.control.Try;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* A function that parses a string into a node value object of type {@link T}.
*
* @param <T> The type of the object to parse.
*/
@FunctionalInterface
public interface NodeStringParser<T> {
/**
* Parses a string into a node value object of type {@link T}.
*
* @param string The string to parse.
* @param type The type of the object to parse.
* @return The parsed object, or {@link Try.Failure} if the string could not be parsed.
*/
@NotNull Try<T> parse(@Nullable String string, @NotNull Class<T> type);
}