Coder Social home page Coder Social logo

autojackson's Introduction

aka Abstractny Mujic

trophy

I work on & with software that builds & runs software:

  • ๐ŸŒฟ Build systems: Bazel, Gradle
  • โ˜ธ Clustering & containers: Kubernetes, Docker
  • ๐Ÿง  Compiler plugins: kotlinc, javac
  • ๐ŸŽจ IDE Plugins: IntelliJ
  • ๐Ÿ› ๏ธ Infrastructure backends
  • ๐Ÿ„ Reactive & async programming: RxJava, Kotlin Coroutines, etc

autojackson's People

Contributors

artem-zinnatullin avatar bryant1410 avatar dani29 avatar hgschmie avatar huatang92 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

autojackson's Issues

Builder with default values

Here's the thing. I'd like to use Builder to support default values for some of the fields. It would look like this:

@AutoValue
@JsonDeserialize(builder = AutoValue_Tweet.Builder.class)
public abstract class Tweet {

    @NotNull
    @JsonCreator
    public static Builder builder() {
        return new AutoValue_Tweet.Builder().content("Immutability not for everybody!");
    }

    @NotNull
    @JsonProperty("author")
    public abstract String author();

    @NotNull
    @JsonProperty("content")
    public abstract String content();

    @AutoValue.Builder
    public static abstract class Builder {

        @NotNull
        @JsonProperty("author")
        public abstract Builder author(@NotNull String author);

        @NotNull
        @JsonProperty("content")
        public abstract Builder content(@NotNull String content);

        @NotNull
        public abstract Tweet build();
    }
}

which according to this page http://wiki.fasterxml.com/JacksonFeatureBuilderPattern should work. Any ideas what I'm doing wrong? Basically @JsonCreator is ignored. With auto value I can't use builder and static factory method (to build in code using builder and jackson would have to deal with factory method) cause c-tor is private.

Annotation @JsonProperty on both class methods and builder methods?

@artem-zinnatullin
Is it really necessary to have "@JsonProperty" annotation on both the abstract method of a class, and the abstract method of the builder? I did some testing, and for me it seemed like enough to only annotate the Builder methods, and leave the class methods unannotated. Is there a specific reason why annotate both?

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.