I think the problem is that the "variable" is static. (the developer told me to 
use static)

from Application.java

public class Application extends ERXApplication {

    public static Pilot appPilot = null;

    ...

    @Override
    public void finishInitialization() {
        ...
        // init Library
        appPilot = new Pilot();
        try {
            ...
            appPilot.init(lKey, lKey, libPath, languageId);
        } catch (PilotException e) {
            ...
        }


inside a class in the framework some ugly code

...
try {
            ...
            // works
            ERXApplication app = ERXApplication.erxApplication();
            Class<? extends ERXApplication> appClass = app.getClass();
            Field appField = appClass.getField("appPilot");
            Pilot appPilot = (Pilot) appField.get(app);
            ...

something like app.valueForKey("appPilot") works only if the variable is not 
static


On 21.10.2011, at 04:02, Andrew Lindesay wrote:

> Hello Jürgen;
> 
> It depends on the situation.
> 
> Can you elaborate what you mean by "variables".
> 
> At the very least, you could use KVC;
> 
>       WOApplication.application().valueForKey(<key>)
> 
> cheers.
> 
> On 21/10/11 1:13 PM, Jürgen Tabert wrote:
>> Hi all,
>> 
>> I am looking for the easiest (best?) way to access a WOApplication variables 
>> from inside a framework.
>> 
>> Thanks for any help,
>> Jürgen
>>  _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/apl%40lindesay.co.nz
>> 
>> This email sent to [email protected]
>> 
> 
> 
> -- 
> Andrew Lindesay
> www.silvereye.co.nz
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/jtabert%40htgreenline.de
> 
> This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to