Skip to content

vigor-yuan/genallsetter2kt

Repository files navigation

GenAllSetter

Version Downloads

This is a plugin for quickly invoking all Set methods of a Java object. It allows you to bid farewell to the pain of manually calling each assignment statement, preventing omissions, and reducing workload. Note that this plugin is only applicable to Android Studio and IntelliJ IDEA.

Installation

  • Using IDE built-in plugin system:

    Preferences > Plugins > Marketplace > Search for "GenAllSetter" > Install Plugin

  • Manually:

    Download the latest release and install it manually using Preferences > Plugins > ⚙️ > Install plugin from disk...

Usage

Shortcuts

You only need to remember the shortcut for Generate, which is ⌘ + N on macOS and Alt + Insert on Windows.

Demonstration

Generate All Setter

If you want to call all Set methods of a Java object, you can do so by invoking the Generate menu on the new object statement and selecting Generate All Setter.

set

Generate All Setter With Default Value

Generate All Setter won't fill in content for you. If you want to automatically fill in default values, you can choose Generate All Setter With Default Value.

set 默认值

Generate All Setter And Getter

The plugin also provides the ability to search for parameters or local variables within the current method that can generate Get methods. When checked, the plugin will search for member variables with the same name and type in parameters or local variables and automatically fill in the get method, achieving a similar effect to BeanUtils. This is useful for object conversion.

set and get

Generate All Builder

In addition to set methods, the plugin also adds support for the common Lombok @Builder chained assignment. You only need to invoke the Generate menu on Object.builder() and select the functionality you want.

ezgif.com-video-to-gif

If you find this plugin helpful:

  • Please give it a star.
  • Share it with others to let more people know about this plugin.