Git Product home page Git Product logo

innerbuilder's Introduction

innerbuilder Build Status

IntelliJ IDEA plugin that adds a 'Builder' action to the Generate menu (Alt+Insert) which generates an inner builder class as described in the Effective Java book. Works with IntelliJ IDEA 2019 and later.

screenshot

public class JavaBean {
    private final String foo;
    private String bar;
    private int qux;
    private Double x,y;

    private JavaBean(Builder builder) {
        foo = builder.foo;
        bar = builder.bar;
        qux = builder.qux;
        x = builder.x;
        y = builder.y;
    }

    public static Builder newJavaBean() {
        return new Builder();
    }

    public static final class Builder {
        private String foo;
        private String bar;
        private int qux;
        private Double x;
        private Double y;

        private Builder() {
        }

        public Builder foo(String val) {
            foo = val;
            return this;
        }

        public Builder bar(String val) {
            bar = val;
            return this;
        }

        public Builder qux(int val) {
            qux = val;
            return this;
        }

        public Builder x(Double val) {
            x = val;
            return this;
        }

        public Builder y(Double val) {
            y = val;
            return this;
        }

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

Installation

In IntelliJ IDEA 2019 or later, open Preferences... > Plugins, search for innerbuilder. It should show up in the plugin list, click INSTALL.

Manual installation

Download the plugin jar innerbuilder.jar and select Install Plugin From Disk in IntelliJ's plugin preferences.

Usage

Use Shift+Alt+B or Alt+Insert and select Builder.... Choose the fields to be included and press OK. When generating a builder when a builder already exists, the plugin will try to update it. It will add missing fields and builder methods, but never remove any fields or methods.

Rate

If you enjoy this plugin, please rate it on its plugins.jetbrains.com page.

Building

  • Run ./prepare-build.sh to download IntelliJ IDEA Community Edition
  • Run mvn package

License

Licensed under the Apache License, Version 2.0.

innerbuilder's People

Contributors

analytically avatar markphilpot avatar fjardlabs avatar minidmnv avatar neilg avatar jheirbaut avatar lanxx019 avatar hahawin avatar lmineiro avatar yuriy-eremin avatar prodikl 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.