io.circe

GenericCursor

abstract class GenericCursor[C <: GenericCursor[C]] extends Serializable

A zipper that represents a position in a JSON document and supports navigation and modification.

The focus represents the current position of the cursor; it may be updated with withFocus or changed using navigation methods like left and right.

circe includes three kinds of cursors. Cursor is the simplest: it doesn't keep track of its history. HCursor is a cursor that does keep track of its history, but does not represent the possibility that a navigation or modification operation has failed. ACursor is the richest cursor, since it both tracks history through an underlying HCursor and can represent failed operations.

GenericCursor is an abstraction over these three types, and it has several abstract type members that are required in order to represent the different roles of the three cursor types. Self is simply the specific type of the cursor, Focus is a type constructor that represents the context in which the focus is available, Result is the type that is returned by all navigation and modification operations, and M is a type class that includes the operations that we need for withFocusM.

Linear Supertypes
Serializable, Serializable, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. GenericCursor
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new GenericCursor()

Type Members

  1. abstract type Focus[_]

    The context that the cursor is available in.

  2. abstract type M[F[_]] <: Functor[F[_]]

    The type class including the operations needed for withFocusM.

  3. abstract type Result

    The type returned by navigation and modifications operations.

Abstract Value Members

  1. abstract def as[A](implicit d: Decoder[A]): Decoder.Result[A]

    Attempt to decode the focus as an A.

  2. abstract def delete: Result

    Delete the focus and move to its parent.

  3. abstract def deleteGoField(k: String): Result

    Delete the focus and move to the sibling with the given key in a JSON object.

  4. abstract def deleteGoFirst: Result

    Delete the focus and move to the first element in a JSON array.

  5. abstract def deleteGoLast: Result

    Delete the focus and move to the last element in a JSON array.

  6. abstract def deleteGoLeft: Result

    Delete the focus and move to the left in a JSON array.

  7. abstract def deleteGoRight: Result

    Delete the focus and move to the right in a JSON array.

  8. abstract def deleteLefts: Result

    Delete all values to the left of the focus in a JSON array.

  9. abstract def deleteRights: Result

    Delete all values to the right of the focus in a JSON array.

  10. abstract def downArray: Result

    If the focus is a JSON array, move to its first element.

  11. abstract def downAt(p: (Json) ⇒ Boolean): Result

    If the focus is a JSON array, move to the first element that satisfies the given predicate.

  12. abstract def downField(k: String): Result

    If the focus is a JSON object, move to the value of the given key.

  13. abstract def downN(n: Int): Result

    If the focus is a JSON array, move to the element at the given index.

  14. abstract def field(k: String): Result

    If the focus is a value in a JSON object, move to a sibling with the given key.

  15. abstract def fieldSet: Option[Set[String]]

    If the focus is a JSON object, return its field names in a set.

  16. abstract def fields: Option[List[String]]

    If the focus is a JSON object, return its field names in their original order.

  17. abstract def find(p: (Json) ⇒ Boolean): Result

    If the focus is an element in a JSON array, find the first element at or to its right that matches the given predicate.

  18. abstract def first: Result

    If the focus is an element in a JSON array, move to the first element.

  19. abstract def focus: Focus[Json]

    The current location in the document.

  20. abstract def get[A](k: String)(implicit d: Decoder[A]): Decoder.Result[A]

    Attempt to decode the value at the given key in a JSON object as an A.

  21. abstract def last: Result

    If the focus is an element in a JSON array, move to the last element.

  22. abstract def left: Result

    If the focus is an element in a JSON array, move to the left.

  23. abstract def leftAt(p: (Json) ⇒ Boolean): Result

    If the focus is an element in a JSON array, move to the left until the given predicate matches the new focus.

  24. abstract def leftN(n: Int): Result

    If the focus is an element in JSON array, move to the left the given number of times.

    If the focus is an element in JSON array, move to the left the given number of times.

    A negative value will move the cursor right.

  25. abstract def lefts: Option[List[Json]]

    If the focus is a JSON array, return the elements to the left.

  26. abstract def replay(history: List[HistoryOp]): Result

    Replay history (a list of operations in reverse "chronological" order) against this cursor.

  27. abstract def right: Result

    If the focus is an element in a JSON array, move to the right.

  28. abstract def rightAt(p: (Json) ⇒ Boolean): Result

    If the focus is an element in a JSON array, move to the right until the given predicate matches the new focus.

  29. abstract def rightN(n: Int): Result

    If the focus is an element in JSON array, move to the right the given number of times.

    If the focus is an element in JSON array, move to the right the given number of times.

    A negative value will move the cursor left.

  30. abstract def rights: Option[List[Json]]

    If the focus is a JSON array, return the elements to the right.

  31. abstract def setLefts(x: List[Json]): Result

    Replace all values to the left of the focus in a JSON array.

  32. abstract def setRights(x: List[Json]): Result

    Replace all values to the right of the focus in a JSON array.

  33. abstract def top: Focus[Json]

    Return to the root of the document.

  34. abstract def up: Result

    Move the focus to the parent.

  35. abstract def withFocus(f: (Json) ⇒ Json): C

    Modify the focus using the given function.

  36. abstract def withFocusM[F[_]](f: (Json) ⇒ F[Json])(implicit arg0: M[F]): F[C]

    Modify the focus in a context using the given function.

Concrete Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  12. def getOrElse[A](k: String)(fallback: ⇒ A)(implicit d: Decoder[A]): Decoder.Result[A]

    Attempt to decode the value at the given key in a JSON object as an A.

    Attempt to decode the value at the given key in a JSON object as an A. If the field k is missing, then use the fallback instead.

  13. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  18. final def set(j: Json): C

    Replace the focus.

  19. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  20. def toString(): String

    Definition Classes
    AnyRef → Any
  21. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Miscellaneous utilities

Type members

Access and navigation

Modification

Array access

Object access

Array navigation

Object navigation

Array modification

Object modification

Decoding

Ungrouped