Fluent Interface-感知
来源:互联网 发布:js 骰子的转动效果 编辑:程序博客网 时间:2024/05/01 12:56
我最初接触这个概念是读自<<模式-工程化实现及扩展>>,另外有Martin fowler大师 所写http://martinfowler.com/bliki/FluentInterface.html
Fluent Interface实例
Java 类Country
package com.jue.fluentinterface;public class Country {private String name;private int code;private boolean isDevelopedCountry;private int area;Country addName(String name) {this.name = name;return this;}Country addCountyCode(int code) {this.code = code;return this;}Country setDeveloped(boolean isdeveloped) {this.isDevelopedCountry = isdeveloped;return this;}Country setAread(int area) {this.area = area;return this;}}
调用类
/** * @param args */public static void main(String[] args) {// TODO Auto-generated method stubCountry china = new Country();china.addName("The People's Republic of China").addCountyCode(1001).setDeveloped(false).setAread(960);}主要特征:
Country 的方法返回本身country,使调用者有了继续调用country方法的能力.
优势
1.有时候我们需要根据传入的参数数目不同定义不同的构造器。使用 FluentInterface就可以随意传递想要的数据,并保持他们的连贯。
java中的应用
StringBuffer append方法
- Fluent Interface-感知
- Fluent interface 简介
- Fluent Interface(流接口)
- Asp.net MVC FluentHTML and Fluent Interface
- Asp.net MVC FluentHTML and Fluent Interface
- Asp.net MVC FluentHTML and Fluent Interface
- FEST-Reflect 1.2:基于Fluent Interface,简单化Java反照的类库
- 基于JDK动态代理实现的接口链式调用(Fluent Interface)工具
- Fluent NHibernate
- Fluent NHibernate
- Fluent UI
- fluent study
- Interface
- interface
- interface
- interface
- interface
- interface
- Linux curl使用简单介绍
- 用SOCKET发送OpenCV的IplImage结构
- hdu 1040 As Easy As A+B
- javascript 基础总结1
- 三款免费的PHP加速器:APC、eAccelerator、XCache比较
- Fluent Interface-感知
- 安装boost的regex模块
- PING用一生诠释了TCP/IP
- DES加密代码
- 在C#中使用Panel控件实现在一个窗体中嵌套另一个窗体
- C# 类型详解
- sizeof与strlen的基本区别
- Oracle10g在CENTOS上的安装和升级(1)——准备篇
- zzy 的宠物 典型的矩阵乘法 二分+递归