javaslang.MatchError Maven / Gradle / Ivy
/* / \____ _ _ ____ ______ / \ ____ __ _______
* / / \/ \ / \/ \ / /\__\/ // \/ \ // /\__\ JΛVΛSLΛNG
* _/ / /\ \ \/ / /\ \\__\\ \ // /\ \ /\\/ \ /__\ \ Copyright 2014-2016 Javaslang, http://javaslang.io
* /___/\_/ \_/\____/\_/ \_/\__\/__/\__\_/ \_// \__/\_____/ Licensed under the Apache License, Version 2.0
*/
package javaslang;
import java.util.NoSuchElementException;
/**
* A {@link API.Match} throws a MatchError if no case matches the applied object.
*
* @author Daniel Dietrich
* @since 1.0.0
*/
public class MatchError extends NoSuchElementException {
private static final long serialVersionUID = 1L;
private final Object obj;
/**
* Internally called by {@link API.Match}.
*
* @param obj The object which could not be matched.
*/
MatchError(Object obj) {
super((obj == null) ? "null" : "type: " + obj.getClass().getName() + ", value: " + obj);
this.obj = obj;
}
/**
* Returns the object which could not be matched.
*
* @return An Object.
*/
public Object getObject() {
return obj;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy