From factory method to abstract factory.
从工厂方法到抽象工厂。
Refactoring: Extract and override factory method.
重构:抽取和覆盖工厂方法。
Using a static factory method to create a Msg object.
使用静态工厂方法创建一个msg对象。
This is a typical example of the Factory Method Pattern.
这是个典型的Factory方法模式实例。
For example, suppose we want to add a factory method to a List class.
例如,假定想将factory方法添加到list类中。
Then, I use the factory method pattern so that the coupling is with the interface.
然后再使用工厂方法模式,这样耦合度就与界面相关联了。
A factory method, by convention, begins with create and returns the interface.
根据约定,factory方法将以create为开头并返回接口。
The class returned by the factory method is an adapter to a particular cloud service.
工厂方法返回的类用于一个特定于服务的适配器。
Assure that the factory method is accessible to the target object and its subclasses.
确保目标对象及其子类可以访问工厂方法。
Convert Property to Auto-Property Introduce Field Replace Constructor with Factory method.
用工厂方法替换构造函数。
In other words, Factory Method lets a class defer the instantiation to its subclasses.
换句话说,Factory方法令一个类实例化到其子类。
This section offers a step-by-step description of the Extract and Override factory method refactoring.
本节将循序渐进地描述“抽取”和“覆盖”工厂方法重构。
CreateInstance is a factory method that returns an instance of PeerNetwork with a specified peer name.
createInstance是个工厂(factory)方法,它返回一个带有指定对等点名称的PeerNet work实例。
This factory method instantiates the collection of course objects by delegating the work to the service layer.
该工厂方法通过将这项工作委托给服务层来实例化课程对象集合。
To create an instance of the Factory Method Pattern, perform the same steps as for the Singleton Pattern.
要创建Factory方法模式的实例,执行同Singleton模式相同的步骤。
The factory method pattern, as its name implies, defines the implementation of a method used to churn out objects.
而工厂方法模式,顾名思义,定义的是一个用来大量产出对象的方法的实现。
The solution here is to provide a method parameter with a factory method for the items to read, as shown in Listing 2.
这里的解决方案是为要读取的条目提供一个带工厂方法的方法参数,如清单2所示。
The example gave a client and server bundle (both in the same VM), and the client found the server via a factory method.
文中的例子给出了一个client和一个serverbundle(两者在同一个VM中),client通过工厂方法找到server。
In fact, many would have started this approach with a factory object, rather than a factory method — we did, but soon backed away.
实际上,许多人已经用工厂对象来着手这种方法,而不是用工厂方法—我们以前是这样做的,但很快就放弃了。
Optional: create a unit test to assure that the original target object's factory method still returns the correct, non-mock object.
可选的:创建单元测试以确保原始目标对象的工厂方法仍返回正确的非模仿对象。
You use the factory method pattern when an application needs to create objects whose type depend on the implementation of subclasses.
您可以在应用程序需要创建其类型依赖于子类的实现的对象时,使用工厂方法模式。
In gpars, actors can be created from a factory method that takes a closure or by subclassing groovyx.gpars.actor.AbstractPooledActor.
在gpars中,可以利用接受闭包的factory方法或通过为groovyx . gpars . actor . AbstractPooledActor划分子类来创建actors。
In this way, the object returned from the static factory method could implement any number of interfaces defined when I create the proxy.
用这种方式,静态工厂方法返回的对象可以实现建立代理时所定义的任意数量的接口。
You can retrieve an MXBean instance from a static factory method that gives you direct access to the locally running JVM's MXBean interface.
您可以从一个静态工厂方法获得一个MXBean实例,该方法可以使您直接访问本地运行的JVM的MXBean接口。
The singleton, builder, and factory method design patterns are considered creational patterns, as they assist in the construction of objects.
单例、生成器和工厂方法设计模式被视为是创建型的模式,因它们可协助对象的构建。
This can be as simple as invoking the base class's factory method and asserting that the returned object is of the correct type. For example.
这与调用基类的工厂方法并断言返回对象具有正确类型一样简单。
Presumably that means IndexReader.open , a static factory method, instantiates an appropriate concrete subclass of IndexReader and returns it.
大概这意味着IndexReader . open,一个静态工厂方法,实例了一个适当的具体的indexreader子类并返回它。
Create the SecurityManager instance based on the configuration (using Shiro’s Factory concept that represents the Factory Method design pattern).
根据配置创建SecurityManager实例(使用Shiro的工厂概念,它表述了 工厂方法设计模式);
Patterns (such as the Factory Method mentioned in this article) are an important tool for understanding and discussing object-oriented design.
模式(如本文中提到的Factory Method模式)是理解和讨论面向对象设计的重要工具。
Patterns (such as the Factory Method mentioned in this article) are an important tool for understanding and discussing object-oriented design.
模式(如本文中提到的Factory Method模式)是理解和讨论面向对象设计的重要工具。
应用推荐