Instance initializers allow you to execute construction code for an anonymous inner class.
实例初始化器允许您为一个匿名内部类执行构造代码。
I find that style difficult to read and test, so I created a named inner class.
我发现这种风格难于读取和测试,所以我创建了一个有名称的内部类。
The code in Listing 1 would be much neater if the anonymous class was placed separately as an inner class.
如果这个匿名类可被作为一个内部类单独放置,那么清单1中的代码将会简洁很多。
Make an inner class in the parent class, which is a test case.
在父类中建立一个内部类,这个内部类是个测试用例。
This is an improvement over having to write a class any time an anonymous inner class is needed and can help keep the code more self-documenting.
相比于每个匿名内部类都要对应一个类的做法来说,这种方式是个极大的改进,同时也使得代码的可读性更好。
The recommended approach is to use static inner classes, if you must use an inner class at all.
推荐的做法是如果非要使用内部类的话,请使用静态内部类。
The first set of enclosing braces delineates the construction of an anonymous inner class, and the second set delineates the instance initializer for the anonymous inner class.
第一组闭合括弧划定一个匿名内部类的构造,第二组划定匿名内部类的实例初始化语句块。
The event handling method of the inner class is shown in Listing 2.
内部类的事件处理方法如清单2 所示。
The CICE proposal is a simpler proposal that addresses the problem that instantiating inner class instances is too cumbersome.
CICE方案要简单得多,它解决了实例化内部类实例不太灵活的问题。
Two things are worth mentioning when considering this code: First, the instantiation of an anonymous inner callback class requires a great amount of boilerplate code.
上面的代码有两点值得我们注意:首先,匿名内部回调类的实例化需要大量的样板代码。
This new inner class helps us to understand and use the following two pairs of new methods in thread.
新的内部类可以帮助我们了解下列两对新方法,并有助于我们在Thread中使用它们。
Here, the ActionListener implementation is defined in place, as an anonymous inner class, and directly attached to the button.
这里,ActionListener实现是适时定义的,它定义为一个匿名内部类,并直接附加到按钮上。
For example, the semantics of return, break, and this are different in a block of code than they are in a Runnable (or other inner class instance) that represents the same block of code.
比如,return、break和this在某一代码块中的语义与其在Runnable(或其他内部类实例)中同一代码块中的语义是不同的。
For each parameter that has a dependency on other parameters, add a PatternDependencyDelegate statement to the constructor of the parameter's dependency inner class (see Listing 3). In this case.
对于每个依赖于其他参数的参数而言,要为参数内部依赖类的构造函数增加PatternDependencyDelegate声明(参看列表3)。
You are returning an instance of JsonRecordWriter, an inner class that will get a line of data from Listing 3 and produce a line of data in Listing 4.
您正在返回一个JsonRecordWriter实例,这是一个内部类,用于从清单3获取数据并生成清单4中的一行数据。
Often this means the proxy will need to be an inner class of Person to have access to private fields.
这通常意味着代理需要是Person的一个内部类,以便能访问private字段。
The MqttSimpleCallback interface is implemented with an inner class.
MqttSimpleCallback接口是使用内部类实现的。
An inner class is added to implement the MqttSimpleCallback interface, and the registration of that handler.
添加内部类以实现MqttSimpleCallback接口和回调处理程序的注册。
To change what our view displays, modify the default code for the ViewContentProvider inner class.
要更改视图显示,修改ViewContentProvider内部类的默认代码。
The OGAdmin class contains several inner classes.
ogadmin类包含多个内部类。
I'm left with some ugly boilerplate code because of the anonymous inner class wrapping this method's real purpose - the two lines of code that appear in the body of the addOrderFrom method.
考虑到包装这个方法的匿名内部类的真正用途,我留下了几行难看的样板代码—addorderfrom方法体中的两行代码。
The addOrderFrom() method collapses to the definition of an anonymous inner class creation of the command class, wrapping the two work items.
addOrderFrom()方法成为公共类的匿名内部类创建的定义,将这两个工作项目包装起来。
The only thing a class needs to be used this way is a default constructor (which allows you to create an anonymous inner class instance inheriting from your class).
惟一需要以这种方式使用一个类的是一个默认构造函数(它允许您创建继承自类的一个匿名内部类)。
This restriction is lifted in Groovy; you can change the values of variables in a containing scope from within an anonymous inner class.
Groovy则消除了这种限制,在Groovy中,匿名内部类可以修改外部的变量值。
An inner class has been implemented for query (lines 31-44) to map returned the ResultSet object to the User object.
为查询实现了一个内部类(31 - 44行)以将ResultSet对象映射到User对象。
And the service-oriented inner class is SERVICE_FORMATTED.
面向服务的内部类是SERVICE_FOR MATTED。
The visitor is implemented in an inner class (aptly called Visitor).
访问者是在一个内部类(称为Visitor 比较好)中实现的。
Otherwise, an inner class will be created to store that element's contents (see name, phone and salary in Listing 9).
否则,将创建一个内部类来存储此元素的内容(见清单9中的name、phone和salary)。
The magnification itself is made by the MagnifiedIcon inner class (lines 95 through 113).
真正的放大工作是由 MagnifiedIcon这个内部类来做的(第95行到第113行)。
The class under test is MyNewClass class (shown here as a private inner class).
待测试的类是mynewclass类(在这里显示为私有内部类)。
应用推荐