Skip to content
Browse files

Match the syntax style in AST.scala to the rest of the library

  • Loading branch information...
1 parent 9083971 commit 6ea8228a3895973b961a78cf1eb80e808f632c8e @tnm tnm committed
Showing with 8 additions and 8 deletions.
  1. +8 −8 src/main/scala/com/codahale/jerkson/AST.scala
View
16 src/main/scala/com/codahale/jerkson/AST.scala
@@ -2,15 +2,15 @@ package com.codahale.jerkson
object AST {
sealed trait JValue {
- def value : Any
+ def value: Any
- def valueAs[A] : A = value.asInstanceOf[A]
+ def valueAs[A]: A = value.asInstanceOf[A]
- def \(fieldName : String) : JValue = JNull
+ def \(fieldName: String): JValue = JNull
- def apply(idx : Int) : JValue = JNull
+ def apply(idx: Int): JValue = JNull
- def \\(fieldName : String) : Seq[JValue] = Nil
+ def \\(fieldName: String): Seq[JValue] = Nil
}
case object JNull extends JValue {
@@ -28,7 +28,7 @@ object AST {
case class JArray(elements: List[JValue]) extends JValue {
def value = null
- override def apply(index : Int) : JValue = {
+ override def apply(index: Int): JValue = {
try {
elements(index)
} catch {
@@ -42,7 +42,7 @@ object AST {
case class JObject(fields: List[JField]) extends JValue {
def value = null
- override def \(fieldName : String) : JValue = {
+ override def \(fieldName: String): JValue = {
fields.find { case JField(name, _) =>
name == fieldName
}.map { case JField(_, value) =>
@@ -50,7 +50,7 @@ object AST {
}.getOrElse(JNull)
}
- override def \\(fieldName : String) : Seq[JValue] = {
+ override def \\(fieldName: String): Seq[JValue] = {
fields.flatMap {
case JField(name, value) if name == fieldName => Seq(value) ++ (value \\ fieldName)
case JField(_, value) => value \\ fieldName

0 comments on commit 6ea8228

Please sign in to comment.
Something went wrong with that request. Please try again.