com.fasterxml.jackson.jr.stree.JrsNull Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jackson-jr-all Show documentation
Show all versions of jackson-jr-all Show documentation
"Uber" jar that contains all Jackson jr components as well as underlying Jackson core
Streaming, in a single jar.
The newest version!
package com.fasterxml.jackson.jr.stree;
import java.io.IOException;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonToken;
/**
* Virtual node used instead of `null`, when an operation does not match an
* actual existing node; this can significantly simplify handling when no
* null checks are needed.
*/
public final class JrsNull extends JrsValue.Scalar
{
final static JrsNull instance = new JrsNull();
public final static JrsNull instance() {
return instance;
}
@Override
public boolean isNull() {
return true;
}
@Override
public JsonToken asToken() {
return JsonToken.VALUE_NULL;
}
@Override
public boolean equals(Object o) {
return (o == this);
}
@Override
public String toString() {
// toString() should never return null
return "null";
}
@Override
public int hashCode() {
return 3;
}
/*
/**********************************************************************
/* Abstract methods
/**********************************************************************
*/
@Override
protected void write(JsonGenerator g, JacksonJrsTreeCodec codec) throws IOException {
g.writeNull();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy