如您所见,构建连贯接口很简单。
As you can see, building fluent interfaces is straightforward.
这种连贯接口的主要优势在于其适应性。
The main advantage of this style of fluent interface lies in its adaptability.
我会向您展示几种连贯接口,首先是方法链接。
I'll show you several types of fluent interfaces, starting with method chaining.
连贯接口固有的一个缺陷在某些情况下也称作终了问题。
One pitfall that's inherent in fluent interfaces under certain circumstances is known as the finishing problem.
构建连贯接口就可以知道什么时候违反一些规则是行得通的。
Building fluent interfaces is an example of knowing when it makes sense to break some of the rules.
连贯接口移除语法中不需要的繁杂干扰,从而实现更可读的代码。
Fluent interfaces remove unnecessary noise from your syntax, allowing for more readable code.
终了问题在您组合连贯接口类的任何时候都有可能出现。
The finishing problem can arise any time you mix fluent-interface classes.
有一个紧凑、直观、可读的连贯接口,能简化功能GUI测试的创建和维护。
A compact, intuitive, and readable fluent interface that simplifies creation and maintenance of functional GUI tests.
Appointment类包含清单2中出现的大部分连贯接口方法。
The Appointment class containing most of the fluent-interface methods appears in Listing 2.
目前为止,我展示了连贯接口dsls三种上下文传递方法中的两种。
Thus far, I've shown two of the three context-passing techniques for fluent-interface DSLs.
连贯接口提供一种简单的方式来更改编写代码的方式,以便您更容易看到一直竭力识别的惯用模式。
Fluent interfaces provide a simple way to change the way you write code so that you can more readily see the idiomatic patterns you've fought to identify.
为了解决该问题,我们将car类转换为一个连贯接口,因而清单3中的代码变为清单4中的连贯接口。
To resolve this problem, we converted our Car class into a fluent interface, so that the code from Listing 3 became the fluent interface shown in Listing 4.
Fowler的书中确定的一个公共dsl模式叫作连贯接口,他将其定义为能够为一系列方法调用中转或维护指令上下文的行为。
A common DSL pattern identified in Fowler's book is called fluent interface, which he defines as behavior capable of relaying or maintaining the instruction context for a series of method calls.
出现错误的原因在于,我试图在连贯接口setter方法被调用之前调用appointment实例上的toString()方法。
The error occurs because I'm trying to call the toString() method on the appointment instance before the rest of the fluent-interface setter methods are called.
出现错误的原因在于,我试图在连贯接口setter方法被调用之前调用appointment实例上的toString()方法。
The error occurs because I'm trying to call the toString() method on the appointment instance before the rest of the fluent-interface setter methods are called.
应用推荐