
in.ashwanthkumar.utils.parser.Success Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of my-java-utils Show documentation
Show all versions of my-java-utils Show documentation
My personal set of utils that I take along with my java projects.
The newest version!
package in.ashwanthkumar.utils.parser;
import in.ashwanthkumar.utils.func.Function;
import java.io.Reader;
public class Success extends ParserResult {
private T result;
public static ParserResult of(T result, String remaining) {
return new Success(result, remaining);
}
private Success(T result, String remaining) {
super(remaining);
this.result = result;
}
@Override
public T get() {
return result;
}
@Override
public ParserResult map(Function transform) {
return Success.of(transform.apply(get()), getRemainingInput());
}
@Override
public boolean successful() {
return true;
}
@Override
public String toString() {
return "Success{" +
"result=" + result +
",remaining=" + remainingInput +
'}';
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy