Re: Subclassing an interface

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

Re: Subclassing an interface

Hervé Girod
Sorry, sent before having user list confirmation. Resend it after
confirmation.

Hervé

Hervé Girod wrote:

> Hello !
>
> Is it possible to subclass a regular Java interface in a bsh script
> without explicitely doing "return (MyClass)this;" at the end of the
> script, or some equivalent ?
>
> In fact, I would like to create a general script framework for my
> application were the script users would not have to bother about
> subclassing in their script. Is it possible in Beanshell ?
>
> Hervé Girod
>


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: Re: Subclassing an interface

Hervé Girod
Thank you !!

Hervé

Daniel Wunsch wrote:

>On Sunday 24 July 2005 14:02, Hervé Girod wrote:
>
>  
>
>>>Is it possible to subclass a regular Java interface in a bsh script
>>>without explicitely doing "return (MyClass)this;" at the end of the
>>>script, or some equivalent ?
>>>      
>>>
>
>something like this? the wrapper funktion provides a
>namespace for the implementation script and does
>the casting for you.
>
>daniel
>
>//## implementation.bsh
>
>var someVariable = "fooBar"
>aMethod() {}
>
>//## wrapper.bsh
>
>MyInterface wrapper() {
> source("implementation.bsh");
> return (MyInterface)this;
>}
>
>
>  
>


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Auto-importing all classes in a specific jar

Bob Evans-7
Hi,

I am adding a set of directories and archives to the classpath with  
addClassPath. I also want to be able to import all of those classes.  
I do not want to auto-import everything on the classpath, just the  
things I am adding to the classpath.

I have already written a mechanism for the source directories. I need  
to write something for the jars. I can of course, open each jar and  
find all packages and import them, so as to auto-import all of those  
classes. However, surely someone else has already done this. Is there  
an existing way to just auto-import the classes in a given jar on the  
classpath?

Thanks,

Bob Evans
Agitar Software



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

RE: Auto-importing all classes in a specific jar

Furash Gary
Some thoughts...

1. I spent a long time fiddling with addClassPath().  It's very cool,
BUT... You run into problems if the developer of the library does weird
namespace things.  That's the extent of my knowledge here - I think Pat
thought there was something they could do abut this ina  future release.

2. I've also thought it would be cool to do away with imports in the
same way you do away with variable declarations.  I'm not sure in a
scripting setting if it adds any value to do all this explicit
importing.  But, then you'd run into collision issues, so I'm not sure
how we'd handle that.

g

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Bob
Evans
Sent: Tuesday, July 26, 2005 1:32 PM
To: [hidden email]
Subject: [Beanshell-users] Auto-importing all classes in a specific jar


Hi,

I am adding a set of directories and archives to the classpath with  
addClassPath. I also want to be able to import all of those classes.  
I do not want to auto-import everything on the classpath, just the  
things I am adding to the classpath.

I have already written a mechanism for the source directories. I need  
to write something for the jars. I can of course, open each jar and  
find all packages and import them, so as to auto-import all of those  
classes. However, surely someone else has already done this. Is there  
an existing way to just auto-import the classes in a given jar on the  
classpath?

Thanks,

Bob Evans
Agitar Software



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Beanshell-users mailing list [hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

RE: Auto-importing all classes in a specific jar

Daniel Leuck
Hi Gary,

> 2. I've also thought it would be cool to do away with imports in the
> same way you do away with variable declarations.  I'm not sure in a
> scripting setting if it adds any value to do all this explicit
> importing.  But, then you'd run into collision issues, so I'm not sure
> how we'd handle that.

You can do this now.

import *;

imports everything, but you may end up having to use fully qualified names
if there are collisions.

JSR 277 (Java Modules) will address namespaces.
http://www.jcp.org/en/jsr/detail?id=277

Dan



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

RE: Auto-importing all classes in a specific jar

Alexey Zinger
In reply to this post by Furash Gary
Lazy auto-importing adds overhead and can create collisions (java.awt.List,
java.util.List).  The other option is auto-importing packages when adding to
the classpath.  But in that case, why not leave both options available: let
addClassPath(URL) work how it always has and then add addClassPath(URL,
boolean) API that allows the user to control whether they want auto-importing
to kick in after the classpath is appended.  In that case auto-importing would
simply step through the JAR or file system directories and invoke appropriate
import statements.  The only issue here is that it may not be possbile when
calling it with a remote URL.

--- Furash Gary <[hidden email]> wrote:

> Some thoughts...
>
> 1. I spent a long time fiddling with addClassPath().  It's very cool,
> BUT... You run into problems if the developer of the library does weird
> namespace things.  That's the extent of my knowledge here - I think Pat
> thought there was something they could do abut this ina  future release.
>
> 2. I've also thought it would be cool to do away with imports in the
> same way you do away with variable declarations.  I'm not sure in a
> scripting setting if it adds any value to do all this explicit
> importing.  But, then you'd run into collision issues, so I'm not sure
> how we'd handle that.
>
> g
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Bob
> Evans
> Sent: Tuesday, July 26, 2005 1:32 PM
> To: [hidden email]
> Subject: [Beanshell-users] Auto-importing all classes in a specific jar
>
>
> Hi,
>
> I am adding a set of directories and archives to the classpath with  
> addClassPath. I also want to be able to import all of those classes.  
> I do not want to auto-import everything on the classpath, just the  
> things I am adding to the classpath.
>
> I have already written a mechanism for the source directories. I need  
> to write something for the jars. I can of course, open each jar and  
> find all packages and import them, so as to auto-import all of those  
> classes. However, surely someone else has already done this. Is there  
> an existing way to just auto-import the classes in a given jar on the  
> classpath?
>
> Thanks,
>
> Bob Evans
> Agitar Software
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Beanshell-users mailing list [hidden email]
> https://lists.sourceforge.net/lists/listinfo/beanshell-users
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
> _______________________________________________
> Beanshell-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/beanshell-users
>


Alexey
2001 Honda CBR600F4i (CCS)
1992 Kawasaki EX500
http://bsheet.sourceforge.net

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

RE: Auto-importing all classes in a specific jar

Furash Gary
In reply to this post by Bob Evans-7
Oooh...  I think we should add this to the tracking DB.

-----Original Message-----
From: Alexey Zinger [mailto:[hidden email]]
Sent: Monday, August 01, 2005 1:51 PM
To: Furash Gary; Bob Evans; [hidden email]
Subject: RE: [Beanshell-users] Auto-importing all classes in a specific
jar


Lazy auto-importing adds overhead and can create collisions
(java.awt.List, java.util.List).  The other option is auto-importing
packages when adding to the classpath.  But in that case, why not leave
both options available: let
addClassPath(URL) work how it always has and then add addClassPath(URL,
boolean) API that allows the user to control whether they want
auto-importing to kick in after the classpath is appended.  In that case
auto-importing would simply step through the JAR or file system
directories and invoke appropriate import statements.  The only issue
here is that it may not be possbile when calling it with a remote URL.

--- Furash Gary <[hidden email]> wrote:

> Some thoughts...
>
> 1. I spent a long time fiddling with addClassPath().  It's very cool,
> BUT... You run into problems if the developer of the library does
> weird namespace things.  That's the extent of my knowledge here - I
> think Pat thought there was something they could do abut this ina  
> future release.
>
> 2. I've also thought it would be cool to do away with imports in the
> same way you do away with variable declarations.  I'm not sure in a
> scripting setting if it adds any value to do all this explicit
> importing.  But, then you'd run into collision issues, so I'm not sure

> how we'd handle that.
>
> g
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Bob
> Evans
> Sent: Tuesday, July 26, 2005 1:32 PM
> To: [hidden email]
> Subject: [Beanshell-users] Auto-importing all classes in a specific
> jar
>
>
> Hi,
>
> I am adding a set of directories and archives to the classpath with
> addClassPath. I also want to be able to import all of those classes.  
> I do not want to auto-import everything on the classpath, just the  
> things I am adding to the classpath.
>
> I have already written a mechanism for the source directories. I need
> to write something for the jars. I can of course, open each jar and  
> find all packages and import them, so as to auto-import all of those  
> classes. However, surely someone else has already done this. Is there

> an existing way to just auto-import the classes in a given jar on the

> classpath?
>
> Thanks,
>
> Bob Evans
> Agitar Software
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies

> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Beanshell-users mailing list [hidden email]
> https://lists.sourceforge.net/lists/listinfo/beanshell-users
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies

> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
> _______________________________________________
> Beanshell-users mailing list [hidden email]
> https://lists.sourceforge.net/lists/listinfo/beanshell-users
>


Alexey
2001 Honda CBR600F4i (CCS)
1992 Kawasaki EX500
http://bsheet.sourceforge.net

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users