This refactoring of the class also improves the code so that we have separated the initialization code from the object construction code.
类的这种重构也会改进代码,因为我们将初始化逻辑从对象的构造函数分离出来了。
Code Listing 2 shows the class implementation.
代码列表2显示了这个类执行。
Intents, like activities, are a special class of application code that describe and define what an application wants done.
目的与活动一样,是应用程序代码中的一个特殊类,定义应用程序要做的事情。
Because only skeleton code is generated, you must next provide concrete implementation code for each class.
因为只生成了框架代码,接下来必须为每个类提供具体的实现代码。
This is, to me, especially troubling since the tools we use let them reverse-engineer a class diagram from their code.
自从我们使用了能够将代码反向工程成为类图的工具以后,这一点就令我尤为困扰。
Listing 2 shows the code for the database wrapper class.
清单2显示了这个数据库封装类的代码。
The largest variety of refactorings are those that reorganize code within a class.
最大一类重构是实现了类内部代码重组的重构方法。
This makes it possible to entirely decouple the caller from the implementation class, which makes your code much more flexible.
这使得将调用者与实现类完全分离成为可能,从而使您的代码更加灵活。
Create an extension to the framework code building class, with which you can customize the generated code.
为框架代码构建类创建扩展,利用此种扩展你可以定制所产生的代码。
Listing 9 shows the complete action class code, not just the segment that changes the project description, so we can learn about some utility methods created for the second revision of the plugin.
清单9显示了完整的操作类代码,不只是改变项目描述的片断,这样我们可以学习为第二版插件创建的一些实用方法。
Inheritance allows you to reuse and customize existing code inside a new class.
继承允许您在新的类中重用和自定义现有的代码。
Another approach would be to create a factory class for instantiating the implementations, but there would still be a dependency to the implementation class in your code.
另一种方法是创建用于实例化实现的工厂类,但是您的代码中仍然存在对实现类的依赖。
This class will contain all code that deals directly with HSQLDB, keeping the contributed extensions code simple.
这个类将包含所有直接处理HSQLDB的代码,并使分配的扩展代码保持简单。
To implement this listener class, we'll code an anonymous class in the main Explorer Window.
为了实现该侦听器类,我们将在主资源管理器窗口中编码一个匿名类。
Then modify the class as code Listing 1 shows.
然后编辑类,代码如列表1 所示。
The generated custom code utilizes a super class model, as shown in the standard generated custom code in Listing 4.
生成的定制代码使用一个超类模型,如清单4中标准生成的定制代码所示。
However, it does not automatically create a skeleton code class that can be used to test the client, and it does not create a sample application.
然而,它并不自动创建可以用来测试客户机的骨架程序代码类,也不创建样本应用程序。
This has the added benefit of separating singleton code from the class code leaving the flexibility to use several instances of the class or using the class as a singleton.
这样分离出单例结构的代码,将有利于保持按单例模式使用类或不按单例模式使用类的灵活性。
In the interest of brevity, we've omitted the code for that class.
为简便起见,我们省略了那个类的代码。
You obtain a new instance of this class by using the code shown in Listing 11.
使用清单11所示的代码获取这个类的新实例。
A class can't be loaded until the executing code makes a reference to that class.
只有在执行代码引用类的时候才加载该类。
To do this using AspectJ, you must compile your class and aspect code with the ajc compiler.
要使用AspectJ 完成这个操作,必须使用ajc编译器来编译类和Aspect代码。
Then, code the MyPlugin class, as shown in Listing 13.
接下来,编写 MyPlugin类的代码,如 清单13所示。
Cheetah generates a custom Python class that implements code for merging the template definition with dynamic data.
Cheetah生成了一个定制python类,该类实现代码来合并模板定义和动态数据。
Because a class instance's code is not pickled, you can add, change, and remove methods without impacting existing pickled instances.
由于不能pickle类实例代码,因此可以添加、更改和除去方法,而不会影响现有的经过pickle的实例。
I use the FileStream class in this code to illustrate operating on data at the byte level.
我使用该代码中的filestream类来说明如何在字节级别操作数据。
The following code shows AppContext class.
以下代码展示了appcontext类。
The controller class contains the code the Web service makes available to a client.
该控制器类包含可用于客户机的Web服务代码。
Modify your provider class to resemble the code in Listing 4.
编辑您的provider类,代码与列表4所示的代码类似。
To create a database row, you create an instance of the corresponding class with the code.
要创建数据库行,需创建对应类的实例,代码如下。
应用推荐