Class

io.circe

GenericCursor

Related Doc: package circe

Permalink

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
Visibility
  1. Public
  2. All

Instance Constructors

  1. new GenericCursor()

    Permalink

Type Members

  1. abstract type Focus[_]

    Permalink

    The context that the cursor is available in.

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

    Permalink

    The type class including the operations needed for withFocusM.

  3. abstract type Result

    Permalink

    The type returned by navigation and modifications operations.

Abstract Value Members

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

    Permalink

    Attempt to decode the focus as an A.

  2. abstract def delete: Result

    Permalink

    Delete the focus and move to its parent.

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

    Permalink

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

  4. abstract def deleteGoFirst: Result

    Permalink

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

  5. abstract def deleteGoLast: Result

    Permalink

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

  6. abstract def deleteGoLeft: Result

    Permalink

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

  7. abstract def deleteGoRight: Result

    Permalink

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

  8. abstract def deleteLefts: Result

    Permalink

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

  9. abstract def deleteRights: Result

    Permalink

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

  10. abstract def downArray: Result

    Permalink

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

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

    Permalink

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

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

    Permalink

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

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

    Permalink

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

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

    Permalink

    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]]

    Permalink

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

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

    Permalink

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

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

    Permalink

    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

    Permalink

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

  19. abstract def focus: Focus[Json]

    Permalink

    The current location in the document.

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

    Permalink

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

  21. abstract def last: Result

    Permalink

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

  22. abstract def left: Result

    Permalink

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

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

    Permalink

    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

    Permalink

    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]]

    Permalink

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

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

    Permalink

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

  27. abstract def right: Result

    Permalink

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

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

    Permalink

    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

    Permalink

    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]]

    Permalink

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

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

    Permalink

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

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

    Permalink

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

  33. abstract def top: Focus[Json]

    Permalink

    Return to the root of the document.

  34. abstract def up: Result

    Permalink

    Move the focus to the parent.

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

    Permalink

    Modify the focus using the given function.

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

    Permalink

    Modify the focus in a context using the given function.

Concrete Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

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

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  10. def hashCode(): Int

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

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

    Permalink
    Definition Classes
    AnyRef
  13. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  14. final def notifyAll(): Unit

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

    Permalink

    Replace the focus.

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

    Permalink
    Definition Classes
    AnyRef
  17. def toString(): String

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

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

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

    Permalink
    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