October 23, 2006

FluentInterface Regular Expressions

Filed under: simplicity — syminfo @ 5:05 pm

Fluent InterfaceA technique for handling a constructor with a great many parameters. You chain together setter methods that return the object. This gives the effect of keyword=value. The catch is, the constructor can’t ensure consistency before the object is constructed.  (source)

Joshua Flanagan has built ‘ReadableRex‘, your ‘fluent interface’ into Regular Expressions. [Joshua’s post]

His example walks you through creating a social security # pattern:  

    Regex socialSecurityNumberCheck = new Regex(Pattern.With.AtBeginning








Create a free website or blog at WordPress.com.