While working on my jfig parser I was doing some google searching
regarding Java enum feature. Came across a tutorial on a technique
making clever use of Java enum, and which was dubbed:

template method pattern

Here's a code snippet based on something I implemented using this
technique per my jfig parser:

http://vossnet.org/template_method_pattern-a_code_snippet.rtf

(Open in something that handles rtf and will have color syntax source
code.)

The gist is that this is a very nice way to bind strings to methods
that are in themselves associated to enum ordinals. Input a string
from somewhere, bind it to its respective enum ordinal, and then
execute a method on the enum object in a OOP polymorphic manner. OOP
polymorphic method dispatch insures the correct method implementation
gets invoked.

Would be a great way to roll minimalist command pattern
implementations, which are frequently driven by simple command
strings. And is just the ticket I need for my parser where will by
doing such string binding/execution on a frequent basis.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to