Bool

com.worxbend.codeberg4s.codec.JsonValue.Bool
final case class Bool(value: Boolean) extends JsonValue

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait JsonValue
class Object
trait Matchable
class Any
Show all

Members list

Value members

Inherited methods

def arrOpt: Option[Vector[JsonValue]]

The array's elements, when this is an array.

The array's elements, when this is an array.

Attributes

Inherited from:
JsonValue
def boolOpt: Option[Boolean]

The boolean, when this is one.

The boolean, when this is one.

Attributes

Inherited from:
JsonValue
def field(name: String): Option[JsonValue]

The value at name, when this is an object that has it.

The value at name, when this is an object that has it.

Total, like every accessor here: an absent key, a non-object receiver and an explicit null are all None. There is deliberately no throwing apply; a JSON document is remote input and this library has no accessor that can fail on it.

This takes the first field named name, which in a parsed document is also the only one: JsonValue.Obj explains why a document that names a field twice is rejected instead of being read.

Attributes

Inherited from:
JsonValue
def isNull: Boolean

Whether this is the JSON literal null.

Whether this is the JSON literal null.

Attributes

Inherited from:
JsonValue
def isNum: Boolean

Whether this is a number, of either case.

Whether this is a number, of either case.

Attributes

Inherited from:
JsonValue
def keys: Vector[String]

The object's field names in document order; empty when this is not an object.

The object's field names in document order; empty when this is not an object.

Attributes

Inherited from:
JsonValue
def kind: String

The JSON kind, for a failure message that says what was found rather than only what was wanted.

The JSON kind, for a failure message that says what was found rather than only what was wanted.

Attributes

Inherited from:
JsonValue
def longOpt: Option[Long]

The number, when this is one, truncated toward zero.

The number, when this is one, truncated toward zero.

Truncation is what a wire int64 field wants and what the previous accessor did — numOpt.map(_.toLong) — so a fractional value still answers with its whole part rather than with None. Nothing is allocated for an JsonValue.Int64 beyond the Option itself.

Attributes

Inherited from:
JsonValue
def numOpt: Option[BigDecimal]

The number, when this is one, as an exact decimal.

The number, when this is one, as an exact decimal.

This builds a BigDecimal for an JsonValue.Int64, which is the case almost every number a response carries lands in — so it undoes, at this one call, the saving the two cases exist for. Reach for longOpt instead whenever a Long is what the caller wanted anyway, which in this library it always is.

Attributes

Inherited from:
JsonValue
def objOpt: Option[Vector[(String, JsonValue)]]

The object's fields in document order, when this is an object.

The object's fields in document order, when this is an object.

Attributes

Inherited from:
JsonValue
def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
def strOpt: Option[String]

The string, when this is one.

The string, when this is one.

Attributes

Inherited from:
JsonValue