Re: [Objectscript-users] retrieve full package from Value
Brought to you by:
rob_d_clark
|
From: <ar...@va...> - 2005-11-17 10:38:55
|
Rob,
No problem. This can happen :)
Thanks for the reply. I think i will look into a solution like you
suggested. I might going to suggest some changes to the OScript codebase
anyway. Maybe i'll get back with a nice solution of some kind.
Regards,
Arjen
> Hi Arjen,
>
> sorry for the late reply... your email got lost many pages up in my
> inbox.
>
> There is not currently a way to get the package name from a Value
> object. I guess I had never thought of this. The main problem is
> that you could, in theory, access the same file in multiple ways.
>
> I guess something could probably be done, by having ScriptPackage not
> return the actual Value object, but rather something that extends
> AbstractValue which implements the get() method to return the actual
> value. This way, there is a "wrapper" around the actual Value, which
> can know how it was accessed.
>
>
> -- Rob
>
>
> On Nov 3, 2005, at 4:46 AM, <ar...@va...>
> <ar...@va...> wrote:
>
>> Hi,
>>
>> I'm working on an application having the Oscript interpreter
>> embedded. I
>> have a Java helper class that calls a function in a scripted
>> object. This
>> function returns another scripted object back to the Java helper.
>> How can
>> i get the full package name from that Value (Scope)-object?
>>
>> Example:
>>
>> lib/someobject.os:
>>
>> public function someobject() {
>> public function test() {
>> }
>> }
>>
>> lib/file.os:
>>
>> public function file() {
>> public function method() {
>>
>> return new pkg.lib.someobject(); <=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>>
>> }
>> }
>>
>> Java helper class:
>>
>> AbstractFile sFile =3D OscriptInterpreter.resolve("lib/file.os", false=
);
>> OscriptInterpreter.eval(sFile, pScope);
>> Value objValue =3D pScope.lookupInScope("file");
>> Value program =3D objValue.callAsConstructor(new Value[0]);
>> Value func =3D program.lookupInScope("method");
>>
>> Value res =3D func.callAsFunction(); <=3D=3D=3D "res" now contains the
>> instantiated "pkg.lib.someobject()" object. But how do i retrieve this
>> information from that Value-object? How do i know the package name
>> and the
>> object name of this Value object?
>>
>> I hope my question is clear enough. Thanks for your help.
>>
>> Regards,
>>
>> Arjen van Efferen
>>
>>
>> -------------------------------------------------------
>> SF.Net email is sponsored by:
>> Tame your development challenges with Apache's Geronimo App Server.
>> Download
>> it for free - -and be entered to win a 42" plasma tv or your very own
>> Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
>> _______________________________________________
>> Objectscript-users mailing list
>> Obj...@li...
>> https://lists.sourceforge.net/lists/listinfo/objectscript-users
>
> -- Rob
>
> ____________________
> CONTACT INFORMATION:
> email: ro...@ti...
> IM: rob@sandjabber
> desk: 1 858 552 2946
> cell: 1 619 300 9661
>
>
>
>
|