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

zygf.jackshaft.conf.JackshaftConfig.scala Maven / Gradle / Ivy

Go to download

Incremental (non-blocking) parsing for Scala JSON ASTs, based on jackson-core.

There is a newer version: 0.2.2
Show newest version
package zygf.jackshaft.conf

import com.fasterxml.jackson.core.JsonFactory

case class JackshaftConfig(maxParsingDepth:    Int = 64,
                           streamingMode:      StreamingMode = StreamingMode.Whitespace,
                           tempBufferProvider: TempBufferProvider = TempBufferProvider.ThreadLocal,
                           jacksonFactory:     JsonFactory = JackshaftConfig.defaultFactory)

object JackshaftConfig
{
  val defaultFactory = (new JsonFactory)
    .enable(JsonFactory.Feature.CANONICALIZE_FIELD_NAMES)
    .disable(JsonFactory.Feature.INTERN_FIELD_NAMES)
  
  val noThreadLocalsFactory = defaultFactory
    .disable(JsonFactory.Feature.USE_THREAD_LOCAL_FOR_BUFFER_RECYCLING)
  
  implicit val default = JackshaftConfig()
  val noThreadLocals = default.copy(tempBufferProvider = TempBufferProvider.Fresh,
                                    jacksonFactory = noThreadLocalsFactory)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy