Java Bean Functionality

Eclim currently provides the ability to generate java bean getters and setters from one or more defined fields.

  • :JavaGetSet - Generates both getters and setters for the field under the cursor or for all fields in the specified range.
  • :JavaGet - Generates getters for the field under the cursor or for all fields in the specified range.
  • :JavaSet - Generates setters for the field under the cursor or for all fields in the specified range.

Given the following file:

public class Foo
{
  private String name;
  private Bar[] bars;
}

You can place the cursor on one of the fields and execute :JavaGetSet to generate the getters and setters for the field. All of the above commands support ranges as well, so you can use a visual selection or a numbered range to generate methods for a set of fields.

Note

The insertion of these methods is done externally with Eclipse and with that comes a couple caveats.

Configuration

Vim Variables

  • g:EclimJavaBeanInsertIndexed (Default: 1) - When set to a value greater than 0, eclim will insert indexed getters and setters for array properties.