Packages

t

kantan.codecs.strings.java8

TimeEncoderCompanion

trait TimeEncoderCompanion[E, T] extends AnyRef

Provides useful methods for a java8 time encoder companions.

Usage note: when declaring default implicit instances, be sure to wrap them in an export.Exported. Otherwise, custom instances and default ones are very likely to conflict.

Source
TimeEncoderCompanion.scala
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TimeEncoderCompanion
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def encoderFrom[D](d: StringEncoder[D]): Encoder[E, D, T]

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. def defaultInstantEncoder: Encoder[E, Instant, T]

    Creates an Encoder instance using the default format.

    Creates an Encoder instance using the default format.

    Example:
    1. scala> import java.time._
      scala> import kantan.codecs.strings._
      
      scala> object Foo extends TimeEncoderCompanion[String, codecs.type] {
           |   override def encoderFrom[D](e: StringEncoder[D]) = e
           | }
      
      scala> Foo.defaultInstantEncoder
           |   .encode(Instant.parse("2000-01-01T12:00:00.000Z"))
      res1: String = 2000-01-01T12:00:00Z
  7. def defaultLocalDateEncoder: Encoder[E, LocalDate, T]

    Creates an Encoder instance using the default format.

    Creates an Encoder instance using the default format.

    Example:
    1. scala> import java.time._
      scala> import kantan.codecs.strings._
      
      scala> object Foo extends TimeEncoderCompanion[String, codecs.type] {
           |   override def encoderFrom[D](e: StringEncoder[D]) = e
           | }
      
      scala> Foo.defaultLocalDateEncoder
           |   .encode(LocalDate.of(2000, 1, 1))
      res1: String = 2000-01-01
  8. def defaultLocalDateTimeEncoder: Encoder[E, LocalDateTime, T]

    Creates an Encoder instance using the default format.

    Creates an Encoder instance using the default format.

    Example:
    1. scala> import java.time._
      scala> import kantan.codecs.strings._
      
      scala> object Foo extends TimeEncoderCompanion[String, codecs.type] {
           |   override def encoderFrom[D](e: StringEncoder[D]) = e
           | }
      
      scala> Foo.defaultLocalDateTimeEncoder
           |   .encode(LocalDateTime.of(2000, 1, 1, 12, 0, 0, 0))
      res1: String = 2000-01-01T12:00:00
  9. def defaultLocalTimeEncoder: Encoder[E, LocalTime, T]

    Creates an Encoder instance using the default format.

    Creates an Encoder instance using the default format.

    Example:
    1. scala> import java.time._
      scala> import kantan.codecs.strings._
      
      scala> object Foo extends TimeEncoderCompanion[String, codecs.type] {
           |   override def encoderFrom[D](e: StringEncoder[D]) = e
           | }
      
      scala> Foo.defaultLocalTimeEncoder
           |   .encode(LocalTime.of(12, 0, 0, 0))
      res1: String = 12:00:00
  10. def defaultOffsetDateTimeEncoder: Encoder[E, OffsetDateTime, T]

    Creates an Encoder instance using the default format.

    Creates an Encoder instance using the default format.

    Example:
    1. scala> import java.time._
      scala> import kantan.codecs.strings._
      
      scala> object Foo extends TimeEncoderCompanion[String, codecs.type] {
           |   override def encoderFrom[D](e: StringEncoder[D]) = e
           | }
      
      scala> Foo.defaultOffsetDateTimeEncoder
           |   .encode(OffsetDateTime.of(2000, 1, 1, 12, 0, 0, 0, ZoneOffset.UTC))
      res1: String = 2000-01-01T12:00:00Z
  11. def defaultZonedDateTimeEncoder: Encoder[E, ZonedDateTime, T]

    Creates an Encoder instance using the default format.

    Creates an Encoder instance using the default format.

    Example:
    1. scala> import java.time._
      scala> import kantan.codecs.strings._
      
      scala> object Foo extends TimeEncoderCompanion[String, codecs.type] {
           |   override def encoderFrom[D](e: StringEncoder[D]) = e
           | }
      
      scala> Foo.defaultZonedDateTimeEncoder
           |   .encode(ZonedDateTime.of(2000, 1, 1, 12, 0, 0, 0, ZoneOffset.UTC))
      res1: String = 2000-01-01T12:00:00Z
  12. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  14. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  15. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  17. def instantEncoder(format: Format): Encoder[E, Instant, T]

    Creates an Encoder instance that uses the specified format.

    Creates an Encoder instance that uses the specified format.

    Example:
    1. scala> import java.time._, format._
      scala> import kantan.codecs.strings._
      
      scala> object Foo extends TimeEncoderCompanion[String, codecs.type] {
           |   override def encoderFrom[D](e: StringEncoder[D]) = e
           | }
      
      scala> Foo.instantEncoder(Format(DateTimeFormatter.ISO_INSTANT.withZone(ZoneOffset.UTC)))
           |   .encode(Instant.parse("2000-01-01T12:00:00.000Z"))
      res1: String = 2000-01-01T12:00:00Z
  18. def instantEncoder(format: => DateTimeFormatter): Encoder[E, Instant, T]

    Creates an Encoder instance that uses the specified format.

    Creates an Encoder instance that uses the specified format.

    Example:
    1. scala> import java.time._, format._
      scala> import kantan.codecs.strings._
      
      scala> object Foo extends TimeEncoderCompanion[String, codecs.type] {
           |   override def encoderFrom[D](e: StringEncoder[D]) = e
           | }
      
      scala> Foo.instantEncoder(DateTimeFormatter.ISO_INSTANT.withZone(ZoneOffset.UTC))
           |   .encode(Instant.parse("2000-01-01T12:00:00.000Z"))
      res1: String = 2000-01-01T12:00:00Z
  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. def localDateEncoder(format: Format): Encoder[E, LocalDate, T]

    Creates an Encoder instance that uses the specified format.

    Creates an Encoder instance that uses the specified format.

    Example:
    1. scala> import java.time._
      scala> import kantan.codecs.strings._
      
      scala> object Foo extends TimeEncoderCompanion[String, codecs.type] {
           |   override def encoderFrom[D](e: StringEncoder[D]) = e
           | }
      
      scala> Foo.localDateEncoder(fmt"yyyy-MM-DD")
           |   .encode(LocalDate.of(2000, 1, 1))
      res1: String = 2000-01-01
  21. def localDateEncoder(format: => DateTimeFormatter): Encoder[E, LocalDate, T]

    Creates an Encoder instance that uses the specified format.

    Creates an Encoder instance that uses the specified format.

    Example:
    1. scala> import java.time._, format._
      scala> import kantan.codecs.strings._
      
      scala> object Foo extends TimeEncoderCompanion[String, codecs.type] {
           |   override def encoderFrom[D](e: StringEncoder[D]) = e
           | }
      
      scala> Foo.localDateEncoder(DateTimeFormatter.ISO_LOCAL_DATE)
           |   .encode(LocalDate.of(2000, 1, 1))
      res1: String = 2000-01-01
  22. def localDateTimeEncoder(format: Format): Encoder[E, LocalDateTime, T]

    Creates an Encoder instance that uses the specified format.

    Creates an Encoder instance that uses the specified format.

    Example:
    1. scala> import java.time._
      scala> import kantan.codecs.strings._
      
      scala> object Foo extends TimeEncoderCompanion[String, codecs.type] {
           |   override def encoderFrom[D](e: StringEncoder[D]) = e
           | }
      
      scala> Foo.localDateTimeEncoder(fmt"yyyy-MM-DD'T'HH:mm:ss.SSS")
           |   .encode(LocalDateTime.of(2000, 1, 1, 12, 0, 0, 0))
      res1: String = 2000-01-01T12:00:00.000
  23. def localDateTimeEncoder(format: => DateTimeFormatter): Encoder[E, LocalDateTime, T]

    Creates an Encoder instance that uses the specified format.

    Creates an Encoder instance that uses the specified format.

    Example:
    1. scala> import java.time._, format._
      scala> import kantan.codecs.strings._
      
      scala> object Foo extends TimeEncoderCompanion[String, codecs.type] {
           |   override def encoderFrom[D](e: StringEncoder[D]) = e
           | }
      
      scala> Foo.localDateTimeEncoder(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
           |   .encode(LocalDateTime.of(2000, 1, 1, 12, 0, 0, 0))
      res1: String = 2000-01-01T12:00:00
  24. def localTimeEncoder(format: Format): Encoder[E, LocalTime, T]

    Creates an Encoder instance that uses the specified format.

    Creates an Encoder instance that uses the specified format.

    Example:
    1. scala> import java.time._
      scala> import kantan.codecs.strings._
      
      scala> object Foo extends TimeEncoderCompanion[String, codecs.type] {
           |   override def encoderFrom[D](e: StringEncoder[D]) = e
           | }
      
      scala> Foo.localTimeEncoder(fmt"HH:mm:ss.SSS")
           |   .encode(LocalTime.of(12, 0, 0, 0))
      res1: String = 12:00:00.000
  25. def localTimeEncoder(format: => DateTimeFormatter): Encoder[E, LocalTime, T]

    Creates an Encoder instance that uses the specified format.

    Creates an Encoder instance that uses the specified format.

    Example:
    1. scala> import java.time._, format._
      scala> import kantan.codecs.strings._
      
      scala> object Foo extends TimeEncoderCompanion[String, codecs.type] {
           |   override def encoderFrom[D](e: StringEncoder[D]) = e
           | }
      
      scala> Foo.localTimeEncoder(DateTimeFormatter.ISO_LOCAL_TIME)
           |   .encode(LocalTime.of(12, 0, 0, 0))
      res1: String = 12:00:00
  26. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  27. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  28. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  29. def offsetDateTimeEncoder(format: Format): Encoder[E, OffsetDateTime, T]

    Creates an Encoder instance that uses the specified format.

    Creates an Encoder instance that uses the specified format.

    Example:
    1. scala> import java.time._
      scala> import kantan.codecs.strings._
      
      scala> object Foo extends TimeEncoderCompanion[String, codecs.type] {
           |   override def encoderFrom[D](e: StringEncoder[D]) = e
           | }
      
      scala> Foo.offsetDateTimeEncoder(fmt"yyyy-MM-DD'T'HH:mm:ss.SSSXX")
           |   .encode(OffsetDateTime.of(2000, 1, 1, 12, 0, 0, 0, ZoneOffset.UTC))
      res1: String = 2000-01-01T12:00:00.000Z
  30. def offsetDateTimeEncoder(format: => DateTimeFormatter): Encoder[E, OffsetDateTime, T]

    Creates an Encoder instance that uses the specified format.

    Creates an Encoder instance that uses the specified format.

    Example:
    1. scala> import java.time._, format._
      scala> import kantan.codecs.strings._
      
      scala> object Foo extends TimeEncoderCompanion[String, codecs.type] {
           |   override def encoderFrom[D](e: StringEncoder[D]) = e
           | }
      
      scala> Foo.offsetDateTimeEncoder(DateTimeFormatter.ISO_OFFSET_DATE_TIME)
           |   .encode(OffsetDateTime.of(2000, 1, 1, 12, 0, 0, 0, ZoneOffset.UTC))
      res1: String = 2000-01-01T12:00:00Z
  31. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  32. def toString(): String
    Definition Classes
    AnyRef → Any
  33. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  34. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  35. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  36. def zonedDateTimeEncoder(format: Format): Encoder[E, ZonedDateTime, T]

    Creates an Encoder instance that uses the specified format.

    Creates an Encoder instance that uses the specified format.

    Example:
    1. scala> import java.time._
      scala> import kantan.codecs.strings._
      
      scala> object Foo extends TimeEncoderCompanion[String, codecs.type] {
           |   override def encoderFrom[D](e: StringEncoder[D]) = e
           | }
      
      scala> Foo.zonedDateTimeEncoder(fmt"yyyy-MM-DD'T'HH:mm:ss.SSSzz")
           |   .encode(ZonedDateTime.of(2000, 1, 1, 12, 0, 0, 0, ZoneOffset.UTC))
      res1: String = 2000-01-01T12:00:00.000Z
  37. def zonedDateTimeEncoder(format: => DateTimeFormatter): Encoder[E, ZonedDateTime, T]

    Creates an Encoder instance that uses the specified format.

    Creates an Encoder instance that uses the specified format.

    Example:
    1. scala> import java.time._, format._
      scala> import kantan.codecs.strings._
      
      scala> object Foo extends TimeEncoderCompanion[String, codecs.type] {
           |   override def encoderFrom[D](e: StringEncoder[D]) = e
           | }
      
      scala> Foo.zonedDateTimeEncoder(DateTimeFormatter.ISO_ZONED_DATE_TIME)
           |   .encode(ZonedDateTime.of(2000, 1, 1, 12, 0, 0, 0, ZoneOffset.UTC))
      res1: String = 2000-01-01T12:00:00Z

Inherited from AnyRef

Inherited from Any

Ungrouped