Here's the tutorial link:

Making the Most of Java 5.0: Enum Tricks
http://www.ajaxonomy.com/2007/java/making-the-most-of-java-50-enum-tricks

Skim down until get to this section: "Enums and Template Methods"


On Dec 5, 1:49 am, ROGER MILLER <[EMAIL PROTECTED]> wrote:
> Hi,
> you mention a tutorial in your post, "template method pattern".
> Can you please give a link to this tutorial?
> I am going to implement a bunch of code to match a token into a
> specific method sometime next week and i collect all technical doc i
> can to find a better approach to do this efficiently.
> Thanks.
> Miller
>
> On Dec 4, 8:41 am, RogerV <[EMAIL PROTECTED]> wrote:
>
> > 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