Package org.bson

Class BsonBoolean

java.lang.Object
org.bson.BsonValue
org.bson.BsonBoolean
All Implemented Interfaces:
Comparable<BsonBoolean>

public final class BsonBoolean extends BsonValue implements Comparable<BsonBoolean>
A representation of the BSON Boolean type.
Since:
3.0
  • Field Details

    • TRUE

      public static final BsonBoolean TRUE
      The true value.
    • FALSE

      public static final BsonBoolean FALSE
      The false value.
  • Constructor Details

    • BsonBoolean

      public BsonBoolean(boolean value)
      Construct a new instance with the given value.
      Parameters:
      value - the value
  • Method Details

    • valueOf

      public static BsonBoolean valueOf(boolean value)
      Returns a BsonBoolean instance representing the specified boolean value.
      Parameters:
      value - a boolean value.
      Returns:
      TRUE if value is true, FALSE if value is false
    • compareTo

      public int compareTo(BsonBoolean o)
      Specified by:
      compareTo in interface Comparable<BsonBoolean>
    • getBsonType

      public BsonType getBsonType()
      Description copied from class: BsonValue
      Gets the BSON type of this value.
      Specified by:
      getBsonType in class BsonValue
      Returns:
      the BSON type, which may not be null (but may be BSONType.NULL)
    • getValue

      public boolean getValue()
      Gets the boolean value.
      Returns:
      the value
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object