Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [xtext-dev] add visitor method to generated AbstractElement interface with @modified tag to

..now i see, thanks the switch classes are self-explanatory and fit my needs

thanks
m

On Mon, Sep 15, 2008 at 11:01 AM, Sven Efftinge <sven@xxxxxxxxxxx> wrote:
> Hi,
> as you were talking about AbstractElement the corresponding switch class is
> XtextSwitch.
> This is an example of how it can be used:
> package org.eclipse.xtext;
> import org.eclipse.xtext.util.XtextSwitch;
> public class ToString extends XtextSwitch<String> {
> @Override
> public String caseGroup(Group object) {
> return "Group";
> }
>
> @Override
> public String caseAssignment(Assignment object) {
> return "Assignment";
> }
>
> @Override
> public String caseAlternatives(Alternatives object) {
> return "Alternative";
> }
>
> public static void main(String[] args) {
> Assignment ass = XtextFactory.eINSTANCE.createAssignment();
> String string = new ToString().doSwitch(ass);
> System.out.println(string);
> }
> }
>
> Hope that helps.
> Sven
>
> On Sep 15, 2008, at 10:32 AM, michael clay wrote:
>
> hi sven,
>
> could you point me in the right direction pls. did you mean
> XtextutilSwitch,ParsetreeSwitch or XtextSwitch
> do you have an example code to showcase the usage of the 'generated
> switch' class to examine if its sufficient?
>
>
> m
>
> On Mon, Sep 15, 2008 at 10:24 AM, Sven Efftinge <sven@xxxxxxxxxxx> wrote:
>
> Hi Michael,
>
> you could use the generated Switch class to do that.
>
> Would that be sufficient?
>
> Sven
>
> On Sep 14, 2008, at 8:13 PM, michael clay wrote:
>
> hi all,
>
> i would like to add a visitor method (@modified) to the generated EMF
>
> AbstractElement interface to  get rid of the various 'instanceof' test
>
> in several places of the xtext code for a cleaner
>
> structuring and better maintainability of the code base.
>
> pls. let me know if this is ok for you.
>
> thx
>
> m
>
> _______________________________________________
>
> xtext-dev mailing list
>
> xtext-dev@xxxxxxxxxxx
>
> https://dev.eclipse.org/mailman/listinfo/xtext-dev
>
> _______________________________________________
>
> xtext-dev mailing list
>
> xtext-dev@xxxxxxxxxxx
>
> https://dev.eclipse.org/mailman/listinfo/xtext-dev
>
> _______________________________________________
> xtext-dev mailing list
> xtext-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/xtext-dev
>
>
> _______________________________________________
> xtext-dev mailing list
> xtext-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/xtext-dev
>
>


Back to the top