sponsor Vim development Vim logo Vim Book Ad

javabean.vim : Adds property getters and setters

 script karma  Rating 13/9, Downloaded by 1797  Comments, bugs, improvements  Vim wiki

created by
Salman Halim
 
script type
utility
 
description
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:javabean_beanPrefix = "m_"

g:javabean_generateArrayAccessors = 1
 
install details
Just pop it into your plugin directory.  Can set g:javabean_scope or b:javabean_scope if \\'protected\\' isn\\'t what you use.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
javabean.vim 2.5 2011-04-18 7.0 Salman Halim 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.
javabean.vim 2.0 2011-04-16 7.0 Salman Halim Added support for array variables to get them by index.
javabean.vim 1.0 2001-07-18 6.0 Salman Halim Initial upload
ip used for rating: 3.141.202.54

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github