javabean.vim


Ⅰ. 插件描述

Adds property getters and setters

Ⅱ. 基本信息

创建日期:  2001-07-18
使用用户:  1
Github星:  1
插件作者:  Salman Halim

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin '/javabean-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle '/javabean-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug '/javabean-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/vim-scripts/javabean.vim

Ⅳ. 文档说明

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

添加新评论