StepBuilder Generator


Source link: https://github.com/iamMehedi/stepbuilder

StepBuilder Generator

IntelliJ IDEA/ Android Studio plugin that adds a 'Step Builder' action to the Generate menu (Alt+Insert) which generates a Builder class which follows the Step Builder pattern. You can read about the Step Builder pattern and why it might be a little more effective than the usual Builder pattern here.

public class Server{

  final static int DEFAULT_PORT = 8080;

private String protocol;
  private String url;
  private String ipAddress;
  private int port;
  private String description;
  private long uptime;

private Server(Builder builder) {

protocol = builder.protocol;

url = builder.url;

ipAddress = builder.ipAddress;

port = builder.port;

description = builder.description;

uptime = builder.uptime;
  
}

public static IProtocol builder() {

return new Builder();

  
}

 public interface IBuild {

Server build();

  
}

public interface IUptime {

IBuild withUptime(long val);

  
}

public interface IDescription {

IUptime withDescription(String val);

  
}

public interface IPort {

IDescription withPort(int val);

  
}

public interface IIpAddress {

IPort withIpAddress(String val);

  
}

public interface IUrl {

IIpAddress withUrl(String val);

  
}

public interface IProtocol {

IUrl withProtocol(String val);

  
}

public static final class Builder implements IUptime, IDescription, IPort, IIpAddress, IUrl, IProtocol, IBuild {

private long uptime;

private String description;

private int port;

private String ipAddress;

private String url;

private String protocol;

 private Builder() {

}

 @Override

public IBuild withUptime(long val) {

 uptime = val;

 return this;

}

 @Override

public IUptime withDescription(String val) {

 description = val;

 return this;

}

 @Override

public IDescription withPort(int val) {

 port = val;

 return this;

}

 @Override

public IPort withIpAddress(String val) {

 ipAddress = val;

 return this;

}

 @Override

public IIpAddress withUrl(String val) {

 url = val;

 return this;

}

 @Override

public IUrl withProtocol(String val) {

 protocol = val;

 return this;

}

 public Server build() {

 return new Server(this);

}

  
}
 
}

Installation

In IntelliJ IDEA 12.x or later, go to File > Settings > Plugins or Intellij IDEA > Preferences > Plugins on Mac OSx. Click the Browse repositories button, in the search field, type online.devliving.stepbuilder.generator or Step Builder Generator. It should show up in the plugin list. Right-click it and select Download and Install.

Manual installation

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

Usage

Use Shift+Ctrl+S or Alt+Insert and select Step Builder. Choose the mandatory fields (the fields that must be set for an object of this class) and press OK.

Rate

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

License

Licensed under the Apache License, Version 2.0.

The source code is based on the code from the innerbuilder plugin.

© Mehedi Hasan Khan

Resources

This tool allows you to tweak your layout in real time just like inspect element in the browser.

Make your native android Toasts Fancy. A library that takes the standard Android toast to the next level with a variety of styling options. Style your toast from code.

This project is an EndlessScroll for RecyclerView

Set alarms for location in map.

An Android Studio project which has a module that contains OpenCV SDK files ported and configured to use CMake and Android Gradle plugin 2.3.1 or above, making it easy to include OpenCV into Android applications.

An offline xls file renderer in google-docs like format.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes