
in.ashwanthkumar.utils.parser.Failure 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;
public class Failure extends ParserResult {
private String message;
public static ParserResult of(String message, String remaining) {
return new Failure(message, remaining);
}
private Failure(String message, String remaining) {
super(remaining);
this.message = message;
}
@Override
public T get() {
throw new RuntimeException("get on Failure is not supported");
}
@Override
public ParserResult map(Function transform) {
return (ParserResult) this;
}
@Override
public boolean successful() {
return false;
}
public String getMessage() {
return message;
}
@Override
public String toString() {
return "Failure{" +
"message='" + message + '\'' +
'}';
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy