I have implemented a solution that is a bit of a
hack, but I can't see how else to proceed.
I have altered the Counter bean to implement a new
interface..
public interface ReadOnlyIterator{ public boolean hasNext(); public Object next(); } This has the advantage that it is not "wrapped" by OGNL and therefore properties such as 'first' and 'last' can be set without errors. I have modified the Iterator tag to recognise this new Interface... private Iterator getIterator() {... } else if (o instanceof ReadOnlyIterator) { return new ReadOnlyIteratorWrapper((ReadOnlyIterator) o); } ... } The class ReadOnlyIteratorWrapper delagates to the ReadOnlyIterator. I have also fixed some bugs in the Counter class itself so that a call to getNext() followed by getCurrent() return the same value. This all seems to work well. Should I upload it into Jira? John.
|
- [OS-webwork] OGNL wrapping iterators? John Patterson
- Re: [OS-webwork] OGNL wrapping iterators? John Patterson
- Re: [OS-webwork] OGNL wrapping iterators? Pat Lightbody