Trait/Object

io.github.netvl.picopickle.TypesComponent

Reader

Related Docs: object Reader | package TypesComponent

Permalink

trait Reader[T] extends AnyRef

A type class for reading a backend representation into an object of the specified type.

All deserialization is done by implicit instances of this trait.

Most clients don't need to subclass this trait directly; use Reader companion object to create readers.

Deserialization process can fail if its input is not valid. Consequently, readers are more like partial functions: they can fail on certain inputs.

T

target type

Self Type
(TypesComponent.this)#Reader[T]
Annotations
@implicitNotFound( ... )
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Reader
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def canRead(value: BValue): Boolean

    Permalink

    Checks if this reader can handle the provided value.

    Checks if this reader can handle the provided value.

    value

    a backend value

    returns

    true if this reader can read from value, false otherwise

  2. abstract def read(value: BValue): T

    Permalink

    Deserializes the value of the specified type from the provided backend value.

    Deserializes the value of the specified type from the provided backend value.

    This method should fail with an exception if canRead returns false on this value and it returns a deserialized object successfully otherwise.

    value

    a backend value

    returns

    deserialized variant of value

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 andThen[U](f: (T) ⇒ U): (TypesComponent.this)#Reader[U]

    Permalink

    Returns a reader which applies the given function to the result of the deserialization.

    Returns a reader which applies the given function to the result of the deserialization.

    U

    result type

    f

    a transformation function

    returns

    a reader which reads a value of type T and then applies f to obtain a value of type U

  5. final def asInstanceOf[T0]: T0

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

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

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

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
  16. final def orElse(other: (TypesComponent.this)#PF[BValue, T]): (TypesComponent.this)#Reader[T]

    Permalink

    A shorthand for this.orElse(Reader(other)), where other is a partial function.

    A shorthand for this.orElse(Reader(other)), where other is a partial function. See Reader.apply.

    other

    a partial function which is used to create the fallback reader

    returns

    see another orElse method

  17. final def orElse(other: (TypesComponent.this)#Reader[T]): (TypesComponent.this)#Reader[T]

    Permalink

    Combines this reader with the specified fallback reader which is used if this reader can't handle the provided value based on its canRead result.

    Combines this reader with the specified fallback reader which is used if this reader can't handle the provided value based on its canRead result.

    other

    the fallback reader

    returns

    a reader which delegates to this reader if this reader can deserialize a value or to the other reader otherwise

  18. def readOrElse(value: BValue, fallback: (BValue) ⇒ T): T

    Permalink

    Deserializes the value of the specified type from the provided backend value or applies the given function if it is impossible.

    Deserializes the value of the specified type from the provided backend value or applies the given function if it is impossible.

    This method is equivalent to if (this.canRead(value)) this.read(value) else fallback(value) (which is in fact its default implementation) but it can be overridden to avoid excessive checks. See PartialFunction.applyOrElse method for longer explanation.

    Reader.apply and Reader.reading method overrides this method to employ the provided partial function applyOrElse method. Consider implementing this method for your readers if for some reason you don't use Reader.apply or Reader.reading.

    value

    a backend value

    fallback

    a fallback function

    returns

    deserialized variant of value or the result of fallback application

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped