Spark Builder Generator

Add this URL to your Eclipse Installation to reach this solution's update site.

2018-09 (4.9)
Photon (4.8)
Oxygen (4.7)
Neon (4.6)
Mars (4.5)
Luna (4.4)
Kepler (4.3)
Juno (4.2, 3.8)
Previous to Juno (<=4.1)


Learn more...

Details Group Tabs

Sunday, November 18, 2018 - 17:19
pambrosini's picture

Amazing Tool,

is possible to add an option to also generate jaxonannotation on top of @Generated ?

something like this:

@JsonDeserialize(builder=TestBean.Builder.class)
public class TestBean implements Serializable{

    private String app;
    private TestInneer inner;

    @Generated("SparkTools")
    private TestBean(Builder builder) {
        this.app = builder.app;
        this.inner = builder.inner;
    }

    public String getApp() {
        return app;
    }
    public void setApp(String app) {
        this.app = app;
    }
    public TestInneer getInner() {
        return inner;
    }
    public void setInner(TestInneer inner) {
        this.inner = inner;
    }
    /**
     * Creates builder to build {@link TestBean}.
     * @return created builder
     */
    @Generated("SparkTools")
    @JsonCreator
    public static Builder builder() {
        return new Builder();
    }
    /**
     * Builder to build {@link TestBean}.
     */
    @Generated("SparkTools")
    @JsonPOJOBuilder(buildMethodName = "build", withPrefix = "")
    public static final class Builder {
        private String app;
        private TestInneer inner;

        private Builder() {
        }

        public Builder app(String app) {
            this.app = app;
            return this;
        }

        public Builder inner(TestInneer inner) {
            this.inner = inner;
            return this;
        }

        public TestBean build() {
            return new TestBean(this);
        }
    }

 

Tanks !

hsparkwpb's picture

Hey Pier,

Jackson annotation support is released with version 0.0.16.

Note, that it is not enabled by default, enable it in the preferences with option "Add Jackson deserialize (@jsondeserialize, @jsonpojobuilder) annotation" to generate for all builders or enable dialog for regular builder generation and you can select "Add Jackson deserialize annotation" to generate the annotations casebycase basis.

Please update and try if everything is working as expected

pambrosini's picture

Work like a charm !! 

Tanks!

hsparkwpb's picture

Hi Pier,

I have created an issue on GitHub:
https://github.com/helospark/SparkBuilderGenerator/issues/37

I'll take a look at it, when I have some free time.

mriehmayf's picture

Works nice, except for inheritance: fields of inherited classes are ignored, thus the created code does not compile.

hsparkwpb's picture

Hi Martina,

Thanks for the feedback, could you please create an issue in the GitHub repository including a simple example and the expected builder? If you do I'll look into fixing it.

Github repo: https://github.com/helospark/SparkBuilderGenerator/issues

mriehmayf's picture

I created issue 30.

hattila's picture

I can not download plugin because you have a network issue :)

bshenkq5's picture

Unable to connect the installation site

hsparkwpb's picture

It's working for me.
Can you access? ftp://helospark.com/eclipse_plugin/SparkBuilderGeneratorPlugin/
Could have been a temporary network outage.