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

org.json4s.DynamicJValue.scala Maven / Gradle / Ivy

There is a newer version: 4.1.0-M8
Show newest version
package org.json4s

import scala.language.dynamics

class DynamicJValue(val raw: JValue) extends Dynamic {

  /**
   * Adds dynamic style to JValues. Only meaningful for JObjects
   * 

* Example:

   * JObject(JField("name",JString("joe"))::Nil).name == JString("joe")
   * 
*/ def selectDynamic(name: String): DynamicJValue = new DynamicJValue(new MonadicJValue(raw) \ name) override def hashCode(): Int = raw.hashCode override def equals(p1: Any): Boolean = p1 match { case j: DynamicJValue => raw == j.raw case j: JValue => raw == j case _ => false } } trait DynamicJValueImplicits { implicit def dynamic2Jv(dynJv: DynamicJValue): JValue = dynJv.raw implicit def dynamic2monadic(dynJv: DynamicJValue): MonadicJValue = new MonadicJValue(dynJv.raw) def dyn(jv: JValue) = new DynamicJValue(jv) } object DynamicJValue extends DynamicJValueImplicits




© 2015 - 2024 Weber Informatics LLC | Privacy Policy