Home > javabean.vim

javabean.vim

Javabean.vim is a project mainly written in Vim Script, it's free.

Adds property getters and setters

This is a mirror of http://www.vim.org/scripts/script.php?script_id=35

Given a number of Java properties in a basic format, this will generate the getters and setters for them; for example, given:

String myString int myInt

you will get:

protected String m_myString; protected int m_myInt;

public void setMyString( String val ) { m_myString = val; }

public String getMyString() { return m_myString; }

public void setMyInt( int val ) { m_myInt = val; }

public int getMyInt() { return m_myInt; }

Version 2.0:

Added getters and setters for array variables; for example:

String[] names

results in:

protected String[] m_names;

public void setNames( String[] val ) { m_names = val; }

public String[] getNames() { return m_names; }

public void setNames( String val, int index ) { m_names[ index ] = val; }

public String getNames( int index ) { return m_names[ index ]; }

Version 2.5:

Added a new variable (g:javabean_generateArrayAccessors--defaults to 1) to control whether or not to generate array index-based getters and setters.

Allowed the specification of the three configuration variables in the Vimrc instead of having to modify this file; the variables and their default values, again, are:

g:javabean_scope = "protected"

g:javabeanbeanPrefix = "m"

g:javabean_generateArrayAccessors = 1

Previous:code.pygit