|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.util.extensions.ActionIterator<A>
public class ActionIterator<A extends Action>
Iterator for iterating over all actions that will be
created by extensions after a call to Registry.useExtensions(ClientContext, ExtensionsFilter, String...)
.
That method returns an ExtensionsInvoker
object which
in it's turn uses this iterator.
Note the phrase "will be created" above. The actions
are created on demand as this iterator moves on the
next item. This happens in the hasNext()
method, which,
for each extension, calls Extension.getActionFactory()
and then ActionFactory.getActions(InvokationContext)
.
The actions returned from the extensions are piled up in an
internal buffer that the next()
method pick items from.
When the buffer is empty the iterator moves on to the actions from
next extension until there are no more extensions and the action
buffer is empty.
Field Summary | |
---|---|
private A[] |
actions
|
private boolean |
checkNext
|
private A |
currentAction
|
private ExtensionContext<A> |
currentContext
|
private boolean |
hasNext
|
private Iterator<ExtensionContext<A>> |
iterator
|
private int |
offset
|
Constructor Summary | |
---|---|
ActionIterator(Iterator<ExtensionContext<A>> iterator)
|
Method Summary | |
---|---|
void |
clearError()
Clear any error that has been registered for the current action. |
Extension<? extends A> |
getExtension()
Get the extension that created the current action. |
ExtensionPoint<? super A> |
getExtensionPoint()
Get the extension point that the current action belongs to. |
Renderer<? super A> |
getRenderer()
Gets the renderer for the current action. |
boolean |
hasNext()
|
A |
next()
|
void |
remove()
Not supported. |
void |
setError(String message,
Throwable t)
Register an error with a message for the current action. |
void |
setError(Throwable t)
Register an error for the current action. |
private boolean |
validActions(A[] actions)
Check that the actions array is a not-null, non-empty array and contains actions of a type that is compatible with the ExtensionPoint.getActionClass() class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private ExtensionContext<A extends Action> currentContext
private A extends Action currentAction
private final Iterator<ExtensionContext<A extends Action>> iterator
private A extends Action[] actions
private int offset
private boolean checkNext
private boolean hasNext
Constructor Detail |
---|
ActionIterator(Iterator<ExtensionContext<A>> iterator)
Method Detail |
---|
public boolean hasNext()
hasNext
in interface Iterator<A extends Action>
public A next()
next
in interface Iterator<A extends Action>
public void remove()
remove
in interface Iterator<A extends Action>
UnsupportedOperationException
- Alwayspublic ExtensionPoint<? super A> getExtensionPoint()
public Extension<? extends A> getExtension()
public Renderer<? super A> getRenderer()
public void clearError()
setError(Throwable)
public void setError(Throwable t)
t
- The error to registerpublic void setError(String message, Throwable t)
t
- The error to registermessage
- An optional messageprivate boolean validActions(A[] actions)
ExtensionPoint.getActionClass()
class.
NOTE! If the array contains at least one invalid action, all actions, including the valid ones, will be ignored. No exception will be thrown. An error-level log message is written to the log file.
actions
- The actions to check
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |