Top Description Fields Constructors Methods
tools.jackson.databind.node

public Class BooleanNode

extends ValueNode
Class Inheritance
Imports
java.util.Optional, tools.jackson.core.*, tools.jackson.databind.SerializationContext

This concrete value class is used to contain boolean (true / false) values. Only two instances are ever created, to minimize memory usage.

Field Summary

Modifier and TypeField and Description
private final boolean
public static final BooleanNode
private static final long
public static final BooleanNode
Inherited from tools.jackson.databind.node.ValueNode:
BD_MAX_INTEGERBD_MAX_LONGBD_MAX_SHORTBD_MIN_INTEGERBD_MIN_LONGBD_MIN_SHORTBI_MAX_INTEGERBI_MAX_LONGBI_MAX_SHORTBI_MIN_INTEGERBI_MIN_LONGBI_MIN_SHORTMISSING

Constructor Summary

AccessConstructor and Description
protected
BooleanNode(boolean v)

Method Summary

Modifier and TypeMethod and Description
protected Boolean
_asBoolean()

Overrides tools.jackson.databind.node.BaseJsonNode._asBoolean.

Method sub-classes should override if they can produce boolean values via asBoolean() -- if not, return null (in which case appropriate error will be thrown or default value returned).

protected String
_asString()

Overrides tools.jackson.databind.node.BaseJsonNode._asString.

Method sub-classes should override if they can produce String values via asString() -- if not, return null (in which case appropriate error will be thrown or default value returned).

protected String
_valueDesc()

Implements abstract tools.jackson.databind.node.BaseJsonNode._valueDesc.

Method for implementation classes to return a short description of contained value, to be used in error messages.

public final boolean
asBoolean()

Overrides tools.jackson.databind.node.BaseJsonNode.asBoolean.

Method that will try to convert value of this node to a Java boolean.

public final boolean
asBoolean(boolean defaultValue)

Overrides tools.jackson.databind.node.BaseJsonNode.asBoolean.

Similar to asBoolean(), but instead of throwing an exception for non-coercible values, will return specified default value.

public Optional<Boolean>
asBooleanOpt()

Overrides tools.jackson.databind.node.BaseJsonNode.asBooleanOpt.

Similar to asBoolean(), but instead of throwing an exception for non-coercible values, will return Optional.empty().

public JsonToken
asToken()

Implements abstract tools.jackson.databind.node.ValueNode.asToken.

Implements tools.jackson.core.TreeNode.asToken.

Method that can be used for efficient type detection when using stream abstraction for traversing nodes.

public boolean
booleanValue()

Overrides tools.jackson.databind.node.BaseJsonNode.booleanValue.

Method that will try to access value of this node as a Java boolean which works if (and only if) node contains JSON boolean value: if not, a JsonNodeException will be thrown.

public boolean
booleanValue(boolean defaultValue)

Overrides tools.jackson.databind.node.BaseJsonNode.booleanValue.

Method similar to booleanValue(), but that will return specified defaultValue if this node does not contain a JSON boolean.

public Optional<Boolean>
booleanValueOpt()

Overrides tools.jackson.databind.node.BaseJsonNode.booleanValueOpt.

Method similar to booleanValue(), but that will return Optional.empty() if this node does not contain a JSON boolean.

public BooleanNode
deepCopy()

Overrides tools.jackson.databind.node.ValueNode.deepCopy.

All current value nodes are immutable, so we can just return them as is.

public boolean
equals(Object o)

Implements abstract tools.jackson.databind.JsonNode.equals.

Equality for node objects is defined as full (deep) value equality.

public static BooleanNode
public JsonNodeType
getNodeType()

Implements abstract tools.jackson.databind.JsonNode.getNodeType.

Return the type of this node

public static BooleanNode
public int
hashCode()

Implements abstract tools.jackson.databind.node.BaseJsonNode.hashCode.

Returns a hash code value for this object.

protected Object
public final void
serialize(JsonGenerator g, SerializationContext provider)

Implements abstract tools.jackson.databind.node.BaseJsonNode.serialize.

Implements tools.jackson.databind.JacksonSerializable.serialize.

Method called to serialize node instances using given generator.

public static BooleanNode
valueOf(boolean b)

Inherited from tools.jackson.databind.node.ValueNode:
_atfindParentfindParentsfindValuefindValuesfindValuesAsStringgetgethashashasNonNullhasNonNullisEmptypathpathserializeWithType

Field Detail

_valueback to summary
private final boolean _value
FALSEback to summary
public static final BooleanNode FALSE
serialVersionUIDback to summary
private static final long serialVersionUID

Hides tools.jackson.databind.node.ValueNode.serialVersionUID.

TRUEback to summary
public static final BooleanNode TRUE

Constructor Detail

BooleanNodeback to summary
protected BooleanNode(boolean v)

Method Detail

_asBooleanback to summary
protected Boolean _asBoolean()

Overrides tools.jackson.databind.node.BaseJsonNode._asBoolean.

Doc from tools.jackson.databind.node.BaseJsonNode._asBoolean.

Method sub-classes should override if they can produce boolean values via asBoolean() -- if not, return null (in which case appropriate error will be thrown or default value returned).

Annotations
@Override
_asStringback to summary
protected String _asString()

Overrides tools.jackson.databind.node.BaseJsonNode._asString.

Doc from tools.jackson.databind.node.BaseJsonNode._asString.

Method sub-classes should override if they can produce String values via asString() -- if not, return null (in which case appropriate error will be thrown or default value returned).

Annotations
@Override
_valueDescback to summary
protected String _valueDesc()

Implements abstract tools.jackson.databind.node.BaseJsonNode._valueDesc.

Doc from tools.jackson.databind.node.BaseJsonNode._valueDesc.

Method for implementation classes to return a short description of contained value, to be used in error messages.

Annotations
@Override
asBooleanback to summary
public final boolean asBoolean()

Overrides tools.jackson.databind.node.BaseJsonNode.asBoolean.

Doc from tools.jackson.databind.JsonNode.asBoolean.

Method that will try to convert value of this node to a Java boolean. JSON Booleans map naturally; Integer numbers other than 0 map to true, and 0 maps to false; null maps to false and Strings 'true' and 'false' map to corresponding values. Other values (including structured types like Objects and Arrays) will result in a JsonNodeException being thrown.

Annotations
@Override
asBooleanback to summary
public final boolean asBoolean(boolean defaultValue)

Overrides tools.jackson.databind.node.BaseJsonNode.asBoolean.

Doc from tools.jackson.databind.JsonNode.asBoolean.

Similar to asBoolean(), but instead of throwing an exception for non-coercible values, will return specified default value.

Annotations
@Override
asBooleanOptback to summary
public Optional<Boolean> asBooleanOpt()

Overrides tools.jackson.databind.node.BaseJsonNode.asBooleanOpt.

Doc from tools.jackson.databind.JsonNode.asBooleanOpt.

Similar to asBoolean(), but instead of throwing an exception for non-coercible values, will return Optional.empty().

Annotations
@Override
asTokenback to summary
public JsonToken asToken()

Implements abstract tools.jackson.databind.node.ValueNode.asToken.

Implements tools.jackson.core.TreeNode.asToken.

Doc from tools.jackson.databind.node.BaseJsonNode.asToken.

Method that can be used for efficient type detection when using stream abstraction for traversing nodes. Will return the first JsonToken that equivalent stream event would produce (for most nodes there is just one token but for structured/container types multiple)

Annotations
@Override
booleanValueback to summary
public boolean booleanValue()

Overrides tools.jackson.databind.node.BaseJsonNode.booleanValue.

Doc from tools.jackson.databind.JsonNode.booleanValue.

Method that will try to access value of this node as a Java boolean which works if (and only if) node contains JSON boolean value: if not, a JsonNodeException will be thrown.

Note

for more lenient conversions, use asBoolean()

Annotations
@Override
booleanValueback to summary
public boolean booleanValue(boolean defaultValue)

Overrides tools.jackson.databind.node.BaseJsonNode.booleanValue.

Doc from tools.jackson.databind.JsonNode.booleanValue.

Method similar to booleanValue(), but that will return specified defaultValue if this node does not contain a JSON boolean.

Annotations
@Override
booleanValueOptback to summary
public Optional<Boolean> booleanValueOpt()

Overrides tools.jackson.databind.node.BaseJsonNode.booleanValueOpt.

Doc from tools.jackson.databind.JsonNode.booleanValueOpt.

Method similar to booleanValue(), but that will return Optional.empty() if this node does not contain a JSON boolean.

Annotations
@Override
deepCopyback to summary
public BooleanNode deepCopy()

Overrides tools.jackson.databind.node.ValueNode.deepCopy.

Doc from tools.jackson.databind.node.ValueNode.deepCopy.

All current value nodes are immutable, so we can just return them as is.

Annotations
@Override
equalsback to summary
public boolean equals(Object o)

Implements abstract tools.jackson.databind.JsonNode.equals.

Doc from tools.jackson.databind.JsonNode.equals.

Equality for node objects is defined as full (deep) value equality. This means that it is possible to compare complete JSON trees for equality by comparing equality of root nodes.

Note

marked as abstract to ensure all implementation classes define it properly and not rely on definition from java.lang.Object.

Annotations
@Override
getFalseback to summary
public static BooleanNode getFalse()
getNodeTypeback to summary
public JsonNodeType getNodeType()

Implements abstract tools.jackson.databind.JsonNode.getNodeType.

Doc from tools.jackson.databind.JsonNode.getNodeType.

Return the type of this node

Annotations
@Override
getTrueback to summary
public static BooleanNode getTrue()
hashCodeback to summary
public int hashCode()

Implements abstract tools.jackson.databind.node.BaseJsonNode.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
readResolveback to summary
protected Object readResolve()
serializeback to summary
public final void serialize(JsonGenerator g, SerializationContext provider) throws JacksonException

Implements abstract tools.jackson.databind.node.BaseJsonNode.serialize.

Implements tools.jackson.databind.JacksonSerializable.serialize.

Doc from tools.jackson.databind.node.BaseJsonNode.serialize.

Method called to serialize node instances using given generator.

Annotations
@Override
valueOfback to summary
public static BooleanNode valueOf(boolean b)