【问题标题】:Eclipse; encapsuling a block of methods蚀;封装方法块
【发布时间】:2015-07-10 07:48:00
【问题描述】:

大家早上好。

我的简单问题是:

有什么方法可以连接方法块吗?

例如:如果我有所有的 getter 和 setter,我可以在一行代码中最小化它们吗?

谢谢!

【问题讨论】:

标签: java eclipse ide


【解决方案1】:

您当然可以在没有 getter 和 setter 的情况下构建 JavaBean。 BeanCustomizer、BeanInfo 和 BeanDescriptor 类。这是一个例子;从此:

private int property;
public int getProperty  (         ){ return property; }
public void setProperty (int value}{ property = value; }

你可以使用类似的东西:

private @property int property;

希望你觉得它有用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-10-23
    • 2011-02-17
    • 2010-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多