- Method Chaining
- Nested Interfaces
- Fluent Builder
Saturday, January 12, 2008
Searching for more Fluent API patterns for Java
Previous posts cover three patterns commonly seen in Fluent APIs in Java.
Subscribe to:
Post Comments (Atom)
3 comments:
People use static imports in Java for fluent interfaces.
Like times(5).withPerson(person).delete()
the times() method call being a static import.
I'm very interested in that topic, other posts about fluent interfaces I've written are about a fluent interface to Google collections or automatically create a fluent implementation for an interface.
http://stephan.reposita.org/archives/2007/10/17/creating-a-fluent-interface-for-google-collections/
http://stephan.reposita.org/archives/2007/10/10/fluent-interface-and-reflection-for-object-building-in-java/
Peace
-stephan
--
Stephan Schmidt :: stephan@reposita.org
Reposita Open Source - Monitor your software development
http://www.reposita.org
Blog at http://stephan.reposita.org - No signal. No noise.
Good point, Stephan. I also use static imports heavily when using Fluent APIs. Without this Java 5 feature, it would be significantly more difficult to create code that resembles natural language sentences.
Hi Steve,
I suggest that you take a look in Martin Fowler's research about DSLs. The address is: http://martinfowler.com/dslwip/
Take a closer look at the internal DSL section: http://martinfowler.com/dslwip/InternalOverview.html
Regards,
Guilherme
Post a Comment