Link Details

If you vote you can be DZone's BFF! Login and vote now.
Link 78717 thumbnail
User 185351 avatar

By jsugrue
via java.dzone.com
Submitted: May 01 2008 / 09:10

I want to share with you a little gadget that uses google-collections. Basically, a rule is a condition and an action. So I will use Predicate as a condition and Function as an action. The composite function then consists of list of rules, for the first predicate that evaluates to true, it will invoke the corresponding function. If none of the predicates are matched - default function will be invoked.
  • 3
  • 3
  • 150
  • 30

Comments

Add your comment
User 190346 avatar

ilazarte replied ago:

0 votes Vote down Vote up Reply

Very cool! I remember thinking up a rules concept a while ago, but being somewhat disappointed that commons collections didn't support generics to make it typesafe. I'm all about the compile-type safety as well; definitely feature more type safe examples like Ricky pointed out!

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (3)



Voters Against This Link (3)