RE: cvs ko?
"Lendvai Attila" <[email protected]>
| Newsgroups | gmane.comp.java.beanshell.devel |
|---|---|
| Message-ID | <E12F73E3BF124B45A118F3323DEB4955706BAC@netvisorpdc.intranet.netvisor.hu> |
:: On Tue, Apr 06, 2004 at 12:08:32PM +0200, Lendvai Attila wrote:
:: >
:: > i've started to work on the ant replacement i've planned.
:: and i would
:: > like to add some extras to BeanShell, for exaple check for
:: iterator()
:: > with reflection so that everything can be enumerated that has an
:: > iterator() method.
::
:: Hi, version 2.0b1 has a new iteration API that allows the
:: enhanced for-loop to
:: work with any kind of collection, array, etc. It's
:: available in a tar ball at
:: http://beanshell.org/developer.html
::
:: I am working on getting 2.0b1 into CVS right now.
thanks, i've seen it. altough this patch of mine is a final generic
case. i iterator over FileSet's that are my own structures. they have
iterator but nothing else of the Collection interface...
i've solved the issue with reflection:
public BshIterator getBshIterator( Object obj )
throws IllegalArgumentException
{
if ( obj instanceof Collection || obj instanceof
Iterator )
return new CollectionIterator( obj );
try
{
Method iteratorGetter =
obj.getClass().getMethod("iterator", null);
if
(Iterator.class.isAssignableFrom(iteratorGetter.getReturnType()))
{
Iterator iterator =
(Iterator)iteratorGetter.invoke(obj, null);
return new CollectionIterator(iterator);
}
}
catch (Exception ignore)
{
}
return new bsh.CollectionManager.BasicBshIterator( obj
);
}
:: > seems like the cvs (as given on the site, and from where
:: i've checked
:: > out the sources) is broken...
::
:: As in, broken broken or just not containing the 2.0 source?
yesterday it war broken broken, but now it still does not contain the
2.0 sources. could be the sf.net read-only cvs delay, so just wait for
one more day.
thanks,
- 101
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click