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.
-
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...
You only need to remember the shortcut for Generate, which is ⌘ + N
on macOS and Alt + Insert
on Windows.
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
.
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
.
The plugin 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.
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.
Starting from version 2.0.5, the plugin now supports:
- Generating getter methods with variable declarations (e.g.,
String name = test.getName();
) - Generating getters from method parameters as well as local variables
- Please give it a star.
- Share it with others to let more people know about this plugin.