Getting all vars in a namespace

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting all vars in a namespace

MICHAEL PITONIAK-2
Team,

Does anyone know how to display all variables that exists in a namespace,
including all those inherited from their parent lineage?

thx for any help.

mike



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: Getting all vars in a namespace

David Spectar
We had to do this and used the Namespace class. So in effect, since we
anticipated requiring this, we passed in the Namespace as a variable into
the user script.

Hope this helps

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of MICHAEL
PITONIAK
Sent: Wednesday, December 13, 2006 06:52 AM
To: [hidden email]
Subject: [Beanshell-users] Getting all vars in a namespace

Team,

Does anyone know how to display all variables that exists in a namespace,
including all those inherited from their parent lineage?

thx for any help.

mike



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: Getting all vars in a namespace

MICHAEL PITONIAK-2

This is what I ended up doing:

public void sourceScript(String scriptPath, String prefFilePath){
        try{
                /*
                 * Child namespaces inherit a copy of all variables and methods
                 * of their parent and can (of course) override / shadow them.
                 * We create a copy of the namespace so as to not add any additional
                 * varaibles to teh callers namespace without using global or super.
                */
                NameSpace ns = new NameSpace(this.caller.namespace, "sourceScriptNS");
                this.interpreter.source(prefFilePath, ns);
                this.interpreter.source(scriptPath, ns);
        }catch(Exception e){
                logError("Line: " +
                        this.namespace.getInvocationLine() + " : " +
                        this.namespace.getInvocationText() + "\n" +
                        "while evaluating file: " + getSourceFileInfo() + " : " +
                        ExceptionServices.getStackTrace(e)
                );
        }
}

>From: "Dave Spectar" <[hidden email]>
>To: "'MICHAEL PITONIAK'"
><[hidden email]>,<[hidden email]>
>Subject: Re: [Beanshell-users] Getting all vars in a namespace
>Date: Fri, 5 Jan 2007 08:48:55 -0800
>
>We had to do this and used the Namespace class. So in effect, since we
>anticipated requiring this, we passed in the Namespace as a variable into
>the user script.
>
>Hope this helps
>
>-----Original Message-----
>From: [hidden email]
>[mailto:[hidden email]] On Behalf Of MICHAEL
>PITONIAK
>Sent: Wednesday, December 13, 2006 06:52 AM
>To: [hidden email]
>Subject: [Beanshell-users] Getting all vars in a namespace
>
>Team,
>
>Does anyone know how to display all variables that exists in a namespace,
>including all those inherited from their parent lineage?
>
>thx for any help.
>
>mike
>
>
>
>-------------------------------------------------------------------------
>Take Surveys. Earn Cash. Influence the Future of IT
>Join SourceForge.net's Techsay panel and you'll get the chance to share
>your
>opinions on IT & business topics through brief surveys - and earn cash
>http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>_______________________________________________
>Beanshell-users mailing list
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/beanshell-users
>
>
>-------------------------------------------------------------------------
>Take Surveys. Earn Cash. Influence the Future of IT
>Join SourceForge.net's Techsay panel and you'll get the chance to share
>your
>opinions on IT & business topics through brief surveys - and earn cash
>http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>_______________________________________________
>Beanshell-users mailing list
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/beanshell-users



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users