All Downloads are FREE. Search and download functionalities are using the official Maven repository.

spice.delta.package.scala Maven / Gradle / Ivy

The newest version!
package spice

import spice.delta.types.Delta
import spice.http.HttpExchange

package object delta {
  implicit class HttpExchangeDelta(exchange: HttpExchange) {
    object deltas {
      private val key: String = "deltas"
      def apply(): List[Delta] = exchange.store.getOrElse[List[Delta]](key, Nil)
      def clear(): Unit = exchange.store.remove(key)
      def ++=(deltas: List[Delta]): Unit = exchange.store(key) = apply() ::: deltas
      def +=(delta: Delta): Unit = this ++= List(delta)
      def isEmpty: Boolean = apply().isEmpty
      def nonEmpty: Boolean = apply().nonEmpty
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy