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.
- Alphabetic
- By Inheritance
- TimeEncoderCompanion
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def encoderFrom[D](d: StringEncoder[D]): Encoder[E, D, T]
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def defaultInstantEncoder: Encoder[E, Instant, T]
Creates an Encoder instance using the default format.
Creates an Encoder instance using the default format.
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
Example: - def defaultLocalDateEncoder: Encoder[E, LocalDate, T]
Creates an Encoder instance using the default format.
Creates an Encoder instance using the default format.
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
Example: - def defaultLocalDateTimeEncoder: Encoder[E, LocalDateTime, T]
Creates an Encoder instance using the default format.
Creates an Encoder instance using the default format.
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
Example: - def defaultLocalTimeEncoder: Encoder[E, LocalTime, T]
Creates an Encoder instance using the default format.
Creates an Encoder instance using the default format.
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
Example: - def defaultOffsetDateTimeEncoder: Encoder[E, OffsetDateTime, T]
Creates an Encoder instance using the default format.
Creates an Encoder instance using the default format.
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
Example: - def defaultZonedDateTimeEncoder: Encoder[E, ZonedDateTime, T]
Creates an Encoder instance using the default format.
Creates an Encoder instance using the default format.
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
Example: - final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- 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.
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
Example: - 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.
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
Example: - final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- 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.
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
Example: - 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.
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
Example: - 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.
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
Example: - 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.
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
Example: - 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.
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
Example: - 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.
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
Example: - final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- 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.
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
Example: - 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.
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
Example: - final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- 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.
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
Example: - 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.
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
Example: