GithubHelp home page GithubHelp logo

isabella232 / jackson-case-class-module Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mesosphere/jackson-case-class-module

0.0 0.0 0.0 26 KB

Deserialization support for Scala case classes, including proper handling of default values.

Scala 100.00%

jackson-case-class-module's Introduction

Jackson Case Class Module

This project is currently unused by Mesosphere projects and will no longer be maintained. We will not be accepting contributions or releasing new versions of this. You are welcome to fork the repo for your own use.

Provides deserialization support for Scala case classes, including proper handling of default values.

Assumes that the default case class constructor's arguments are sufficient for deserialization.

SBT:

resolvers += "Mesosphere Public Repository" at "http://downloads.mesosphere.io/maven"
libraryDependencies += "mesosphere" %% "jackson-case-class-module" % "0.1.2"

Maven:

<repository>
  <id>mesosphere-public-repo</id>
  <name>Mesosphere Public Repo</name>
  <url>http://downloads.mesosphere.io/maven</url>
</repository>

<dependency>
  <groupId>mesosphere</groupId>
  <artifactId>jackson-case-class-module_2.10</artifactId>
  <version>0.1.2</version>
</dependency>

Usage

NOTE: when using Jackson that case classes should be at the top level of your file to avoid issues that prevent jackson from being able to instantiate a new instance of your case class

import mesosphere.jackson.CaseClassModule
import com.fasterxml.jackson.module.scala.DefaultScalaModule

val mapper = new ObjectMapper
mapper.registerModule(DefaultScalaModule)
mapper.registerModule(CaseClassModule)

case class Person(name: String, age: Integer = 30)

val readResult = mapper.readValue(
  """{ "name": "Alfonso" }""",
  classOf[Person]
)

assert(readResult.age == 30) // hooray

jackson-case-class-module's People

Contributors

benwhitehead avatar connordoyle avatar drexin avatar ssk2 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.