org.javasimon.console.text.NoneStringifier Maven / Gradle / Ivy
package org.javasimon.console.text;
/**
* Stringifier with particular meaning: do not stringify this value.
* @author gquintana
*/
public class NoneStringifier implements Stringifier {
private NoneStringifier() {
}
public String toString(T value) {
throw new UnsupportedOperationException("Do not stringify");
}
private static final NoneStringifier INSTANCE=new NoneStringifier();
/**
* Get unique instance of the NoneStringifier
*/
public static NoneStringifier getInstance() {
return (NoneStringifier) INSTANCE;
}
/**
* Check whether stringifier is the NoneStringifier
* @param stringifier Stringifier to compare with NoneStringifier
* @return null when stringifier==NoneStringifier, else given stringifier
*/
public static Stringifier checkInstance(Stringifier stringifier) {
return INSTANCE==stringifier?null:stringifier;
}
}