kantan.codecs.strings

StringDecoder

object StringDecoder extends DecoderCompanion[String, DecodeError, codecs.type]

Provides instance creation and summing methods for StringDecoder.

Default StringDecoder instances are provided in codecs.

Linear Supertypes
DecoderCompanion[String, DecodeError, codecs.type], Serializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. StringDecoder
  2. DecoderCompanion
  3. Serializable
  4. Serializable
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

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. def apply[D](implicit ev: Decoder[String, D, DecodeError, codecs.type]): Decoder[String, D, DecodeError, codecs.type]

    Summons an implicit instance of Decoder if one is found, fails compilation otherwise.

    Summons an implicit instance of Decoder if one is found, fails compilation otherwise.

    This is a slightly faster, less verbose version of implicitly.

    Definition Classes
    DecoderCompanion
    Annotations
    @macroImpl( ... )
  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def dateDecoder(format: DateFormat): StringDecoder[Date]

    Creates a StringDecoder instance for java.util.Date.

    Creates a StringDecoder instance for java.util.Date.

    scala> import java.text.SimpleDateFormat
    
    scala> val format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz")
    
    scala> implicit val decoder: StringDecoder[java.util.Date] = StringDecoder.dateDecoder(format)
    
    scala> decoder.decode("2016-01-17T22:03:12.012UTC").map(format.format)
    res1: kantan.codecs.Result[DecodeError, String] = Success(2016-01-17T22:03:12.012UTC)
    format

    format used when parsing date values.

  10. final def eq(arg0: AnyRef): Boolean

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

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

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. def from[D](f: (String) ⇒ Result[DecodeError, D]): Decoder[String, D, DecodeError, codecs.type]

    Creates a new Decoder instance from the specified function.

    Creates a new Decoder instance from the specified function.

    Definition Classes
    DecoderCompanion
    Annotations
    @inline()
  14. def fromPartial[D](f: PartialFunction[String, Result[DecodeError, D]])(implicit t: IsError[DecodeError]): Decoder[String, D, DecodeError, codecs.type]

    Definition Classes
    DecoderCompanion
  15. def fromUnsafe[D](f: (String) ⇒ D)(implicit t: IsError[DecodeError]): Decoder[String, D, DecodeError, codecs.type]

    Creates a new Decoder instance from the specified function.

    Creates a new Decoder instance from the specified function.

    This method turns the specified function safe. The error message might end up being a bit generic though - use from if you want to deal with errors explicitly.

    Definition Classes
    DecoderCompanion
    Annotations
    @inline()
  16. final def getClass(): Class[_]

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

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

    Definition Classes
    Any
  19. def makeSafe[D](typeName: String)(f: (String) ⇒ D): (String) ⇒ Result[DecodeError, D]

    Creates a safe decoding function from the specified unsafe one.

    Creates a safe decoding function from the specified unsafe one.

    This method expects the specified decoding function to be able to fail by throwing exceptions. These will be caught and wrapped in DecodeError.

    scala> val decoder = StringDecoder.makeSafe("Int")(_.toInt)
    
    scala> decoder("1")
    res1: kantan.codecs.Result[DecodeError, Int] = Success(1)
    
    scala> decoder("foobar")
    res2: kantan.codecs.Result[DecodeError, Int] = Failure(DecodeError: 'foobar' is not a valid Int)

    This is typically used in conjunction with [StringDecoder.from], when creating instances for types that are not isomorphic to String.

    D

    decoded type.

    typeName

    name of the decoded type (used in error messages).

    f

    decoding function.

  20. final def ne(arg0: AnyRef): Boolean

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

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

    Definition Classes
    AnyRef
  23. def oneOf[D](ds: Decoder[String, D, DecodeError, codecs.type]*)(implicit i: IsError[DecodeError]): Decoder[String, D, DecodeError, codecs.type]

    Creates a new Decoder instance from the specified alternatives.

    Creates a new Decoder instance from the specified alternatives.

    When decoding, each of the specified decoders will be attempted. The result will be the first success if found, or the last failure otherwise.

    Definition Classes
    DecoderCompanion
    Annotations
    @inline()
  24. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  25. def toString(): String

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

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from DecoderCompanion[String, DecodeError, codecs.type]

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped