Hi

As far has I know (I might be wrong), the generators are executed during
the compilation of the web app. So I think you can't do that without
recompiling you app.

If you recompile your app, with all your plugins in your classpath, you can
implement a generator that will scan for Pet implementations and
instanciate a given class for exemple.

Ex (generated code):
public Pet newPet(Class<? extends Pet> clazz) {
    if (clazz.getName().equals("pet.Cat") return new pet.Cat();
    if (clazz.getName().equals("pet.Dog") return new pet.Dog();
    return null;
}

Le ven. 14 sept. 2018 à 15:09, Matthew Bergshoeff <
[email protected]> a écrit :

>  Hi Everyone - I've been searching everywhere for a solution to this and
> haven't been able to resolve it. I don't think I've properly wrapped my
> head around the issue, so hoping someone could provide some guidance.
>
> I am trying to build a modular GWT application - by that I mean that there
> will be the core application, but it should support the addition of gwt
> modules ("plugins") without having to rebuild. This is being accomplished
> by updating parameters in the web.xml so that I can just stop the webapp,
> add a .jar file to the /lib directory, define the new .jar in the web.xml
> and restart the application. So far so good. The problem arises when trying
> to initialize/access the classes within the plugins.
>
> Let's imagine I had a PetStore application (classic example!). I have an
> interface called *Pet* that is implemented by some classic examples (Cat,
> Dog, Fish) in the core application. However, I want to be able to add a
> plugin for an exotic pet (Borneo Pygmy Elephant), and have the application
> (client-side) be able to load the class when a record comes up that refers
> to it. I am able to do this server-side using a URLClassLoader, but can't
> figure out how to use a Generator to instantiate all possible *Pet*
> implementations within a module.
>
> If I am going to implement a generator, should it be in the plugin or in
> the core application? I've found a few examples, but none seem to pinpoint
> exactly what I'm trying to do. Appreciate any help...
>
> --
> You received this message because you are subscribed to the Google Groups
> "GWT Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/google-web-toolkit.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to