什么是设计ala的术语“object.method1()。method2()。method3()”? [英] What's the term for design ala "object.method1().method2().method3()"?

查看:154
本文介绍了什么是设计ala的术语“object.method1()。method2()。method3()”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个设计的用语是什么?

  object.method1()。method2()。method3 b 


$ b

我发现这个术语,一会儿,但失去了它。
我不知道如何在google上搜索这个:)
如果任何人都可以想到一个更好的标题的问题,随时更改它。



感谢



Update-Gishu :看完之后,我觉得你的问题是误导性的提供的代码段..(随意回滚)



方法链接

  object.method1()。method2()。method3()

接口



  private void makeFluent(Customer customer){
customer.newOrder )
.with(6,TAL)
.with(5,HPK)。skippable()
.with(3,LGV)
.priorityRush ();
}


解决方案

描述流畅的接口。 Ive也听说它被称为管道或链接。



Update-Gishu: http://martinfowler.com/bliki/FluentInterface.html


What's the term for this design?

object.method1().method2().method3()

..when all methods return *this?

I found the term for this a while ago, but lost it meanwhile. I have no clue how to search for this on google :) Also if anyone can think of a better title for the question, feel free to change it.

Thanks

Update-Gishu: After reading about it, I feel that your question is misleading w.r.t. code snippet provided.. (Feel free to rollback)

Method Chaining

object.method1().method2().method3()

Fluent Interfaces

private void makeFluent(Customer customer) {
        customer.newOrder()
                .with(6, "TAL")
                .with(5, "HPK").skippable()
                .with(3, "LGV")
                .priorityRush();
    }

解决方案

Looks to me like you are describing a fluent interface. Ive also heard it referred to as pipelineing or chaining.

Update-Gishu: http://martinfowler.com/bliki/FluentInterface.html

这篇关于什么是设计ala的术语“object.method1()。method2()。method3()”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆