Top Description Inners Fields Constructors Methods
com.sun.faces.renderkit

public final Class SelectItemsIterator<T extends SelectItem>

extends Object
implements Iterator<SelectItem>
Class Inheritance
All Implemented Interfaces
java.util.Iterator
Imports
java.io.IOException, .NotSerializableException, .ObjectInputStream, .ObjectOutputStream, java.lang.reflect.Array, java.util.Iterator, .ListIterator, .Map, .NoSuchElementException, jakarta.faces.component.UIComponent, .UISelectItem, .UISelectItems, .UISelectMany, .UISelectOne, jakarta.faces.context.FacesContext, jakarta.faces.model.SelectItem

Package private class for iterating over the set of SelectItems for a parent UISelectMany or UISelectOne.

// RELEASE_PENDING (rlubke,driscoll) performanc review

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
SelectItemsIterator.ArrayIterator

Handles arrays of SelectItems, generic Objects, or combintations of both.

private static interface
private abstract static class
SelectItemsIterator.GenericObjectSelectItemIterator

Base class to support iterating over Collections or Arrays that may or may not contain SelectItem instances.

private static class
SelectItemsIterator.IterableItemIterator

Handles Collections of SelectItems, generic Objects, or combintations of both.

private static class
SelectItemsIterator.MapIterator

Iterates over a Map of values exposing each entry as a SelectItem.

private static class
SelectItemsIterator.SingleElementIterator

Exposes single SelectItem instances as an Iterator.

Field Summary

Modifier and TypeField and Description
private FacesContext
ctx

The FacesContext for the current request.

private SelectItemsIterator.ComponentAwareSelectItemIterator<SelectItem>
items

Iterator over the SelectItem elements pointed at by a UISelectItems component, or null.

private ListIterator<UIComponent>
kids

Iterator over the children of the parent component.

private SelectItemsIterator.SingleElementIterator
singleItemIterator

Expose single SelectItems via an Iterator.

Constructor Summary

AccessConstructor and Description
public
SelectItemsIterator(FacesContext
the FacesContext for the current request
ctx
,
UIComponent
The parent UIComponent whose children will be processed
parent
)

Construct an iterator instance for the specified parent component.

Method Summary

Modifier and TypeMethod and Description
public UIComponent
private Object

Returns:

the next valid child for processing
findNextValidChild
()

public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Return true if the iteration has more elements.

private void
initializeItems(Object kid)

Initializes the items instance variable with an Iterator appropriate to the UISelectItem(s) value.

public SelectItem
next()

Implements java.util.Iterator.next.

Return the next element in the iteration.

public void
remove()

Overrides default java.util.Iterator.remove.

Throw UnsupportedOperationException.

private void
updateSingeItemIterator(UIComponent selectComponent, SelectItem
the SelectItem to expose as an Iterator
item
)

Update the singleItemIterator with the provided item

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ctxback to summary
private FacesContext ctx

The FacesContext for the current request.

itemsback to summary
private SelectItemsIterator.ComponentAwareSelectItemIterator<SelectItem> items

Iterator over the SelectItem elements pointed at by a UISelectItems component, or null.

kidsback to summary
private ListIterator<UIComponent> kids

Iterator over the children of the parent component.

singleItemIteratorback to summary
private SelectItemsIterator.SingleElementIterator singleItemIterator

Expose single SelectItems via an Iterator. This iterator will be reset/reused for each individual SelectItem instance encountered.

Constructor Detail

SelectItemsIteratorback to summary
public SelectItemsIterator(FacesContext ctx, UIComponent parent)

Construct an iterator instance for the specified parent component.

Parameters
ctx:FacesContext

the FacesContext for the current request

parent:UIComponent

The parent UIComponent whose children will be processed

Method Detail

currentSelectComponentback to summary
public UIComponent currentSelectComponent()
findNextValidChildback to summary
private Object findNextValidChild()
Returns:Object

the next valid child for processing

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Return true if the iteration has more elements.

Returns:boolean

Doc from java.util.Iterator.hasNext.

true if the iteration has more elements

Annotations
@Override
initializeItemsback to summary
private void initializeItems(Object kid)

Initializes the items instance variable with an Iterator appropriate to the UISelectItem(s) value.

nextback to summary
public SelectItem next()

Implements java.util.Iterator.next.

Return the next element in the iteration.

Returns:SelectItem

Doc from java.util.Iterator.next.

the next element in the iteration

Annotations
@Override
Exceptions
NoSuchElementException:
if there are no more elements
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Throw UnsupportedOperationException.

Annotations
@Override
updateSingeItemIteratorback to summary
private void updateSingeItemIterator(UIComponent selectComponent, SelectItem item)

Update the singleItemIterator with the provided item

Parameters
item:SelectItem

the SelectItem to expose as an Iterator

com.sun.faces.renderkit back to summary

private final Class SelectItemsIterator.ArrayIterator

extends GenericObjectSelectItemIterator
Class Inheritance

Handles arrays of SelectItems, generic Objects, or combintations of both. A single GenericObjectSelectItem will be leverage for any non-SelectItem objects encountered.

Field Summary

Modifier and TypeField and Description
private Object
private int
private FacesContext
private int
Inherited from com.sun.faces.renderkit.SelectItemsIterator.GenericObjectSelectItemIterator:
sourceComponent

Constructor Summary

AccessConstructor and Description
private
ArrayIterator(FacesContext ctx, UISelectItems sourceComponent, Object array)

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public SelectItem
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).

Inherited from com.sun.faces.renderkit.SelectItemsIterator.GenericObjectSelectItemIterator:
currentSelectComponentgetSelectItemFor

Field Detail

arrayback to summary
private Object array
countback to summary
private int count
ctxback to summary
private FacesContext ctx
indexback to summary
private int index

Constructor Detail

ArrayIteratorback to summary
private ArrayIterator(FacesContext ctx, UISelectItems sourceComponent, Object array)

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public SelectItem next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:SelectItem

the next element in the iteration

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override
com.sun.faces.renderkit back to summary

private Interface SelectItemsIterator.ComponentAwareSelectItemIterator<E>

extends Iterator<E>
Known Direct Implementers
com.sun.faces.renderkit.SelectItemsIterator.SingleElementIterator, com.sun.faces.renderkit.SelectItemsIterator.MapIterator, com.sun.faces.renderkit.SelectItemsIterator.GenericObjectSelectItemIterator

Method Summary

Modifier and TypeMethod and Description
public UIComponent
Inherited from java.util.Iterator:
forEachRemaininghasNextnextremove

Method Detail

currentSelectComponentback to summary
public UIComponent currentSelectComponent()
com.sun.faces.renderkit back to summary

private abstract Class SelectItemsIterator.GenericObjectSelectItemIterator

extends Object
implements SelectItemsIterator.ComponentAwareSelectItemIterator<SelectItem>
Class Inheritance
  • java.lang.Object
  • com.sun.faces.renderkit.SelectItemsIterator.GenericObjectSelectItemIterator
All Implemented Interfaces
com.sun.faces.renderkit.SelectItemsIterator.ComponentAwareSelectItemIterator, java.util.Iterator
Known Direct Subclasses
com.sun.faces.renderkit.SelectItemsIterator.ArrayIterator, com.sun.faces.renderkit.SelectItemsIterator.IterableItemIterator

Base class to support iterating over Collections or Arrays that may or may not contain SelectItem instances.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
SelectItemsIterator.GenericObjectSelectItemIterator.GenericObjectSelectItem

A SelectItem implementation to support generating unique SelectItem values based on ValueExpressions from the owning UISelectItems instance.

Field Summary

Modifier and TypeField and Description
private SelectItemsIterator.GenericObjectSelectItemIterator.GenericObjectSelectItem
genericObjectSI

SelectItem that is updated based on the current Object being iterated over.

protected transient UISelectItems
sourceComponent

The source UISelectItems.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public UIComponent
protected SelectItem
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

genericObjectSIback to summary
private SelectItemsIterator.GenericObjectSelectItemIterator.GenericObjectSelectItem genericObjectSI

SelectItem that is updated based on the current Object being iterated over.

sourceComponentback to summary
protected transient UISelectItems sourceComponent

The source UISelectItems.

Constructor Detail

GenericObjectSelectItemIteratorback to summary
protected GenericObjectSelectItemIterator(UISelectItems sourceComponent)

Method Detail

currentSelectComponentback to summary
public UIComponent currentSelectComponent()

Implements com.sun.faces.renderkit.SelectItemsIterator.ComponentAwareSelectItemIterator.currentSelectComponent.

Annotations
@Override
getSelectItemForback to summary
protected SelectItem getSelectItemFor(FacesContext ctx, Object value)
com.sun.faces.renderkit back to summary

private final Class SelectItemsIterator.GenericObjectSelectItemIterator.GenericObjectSelectItem

extends SelectItem
Class Inheritance

A SelectItem implementation to support generating unique SelectItem values based on ValueExpressions from the owning UISelectItems instance.

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private UISelectItems
private static final String
private String
var

The request-scoped variable under which the current object will be exposed.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private void
private void
updateItem(FacesContext
the FacesContext for the current request
ctx
,
Object
the value to build the updated values from
value
)

Updates the SelectItem properties based on the current value.

private void
Inherited from jakarta.faces.model.SelectItem:
getDescriptiongetLabelgetValueisDisabledisEscapeisNoSelectionOptionsetDescriptionsetDisabledsetEscapesetLabelsetNoSelectionOptionsetValue

Field Detail

ITEM_DESCRIPTIONback to summary
private static final String ITEM_DESCRIPTION
ITEM_DISABLEDback to summary
private static final String ITEM_DISABLED
ITEM_ESCAPEDback to summary
private static final String ITEM_ESCAPED
ITEM_LABELback to summary
private static final String ITEM_LABEL
ITEM_VALUEback to summary
private static final String ITEM_VALUE
NO_SELECTION_OPTIONback to summary
private static final String NO_SELECTION_OPTION
NO_SELECTION_VALUEback to summary
private static final String NO_SELECTION_VALUE
sourceComponentback to summary
private UISelectItems sourceComponent
VARback to summary
private static final String VAR
varback to summary
private String var

The request-scoped variable under which the current object will be exposed.

Constructor Detail

GenericObjectSelectItemback to summary
private GenericObjectSelectItem(UISelectItems sourceComponent)

Method Detail

readObjectback to summary
private void readObject(ObjectInputStream in) throws IOException
updateItemback to summary
private void updateItem(FacesContext ctx, Object value)

Updates the SelectItem properties based on the current value.

Parameters
ctx:FacesContext

the FacesContext for the current request

value:Object

the value to build the updated values from

writeObjectback to summary
private void writeObject(ObjectOutputStream out) throws IOException
com.sun.faces.renderkit back to summary

private final Class SelectItemsIterator.IterableItemIterator

extends GenericObjectSelectItemIterator
Class Inheritance

Handles Collections of SelectItems, generic Objects, or combintations of both. A single GenericObjectSelectItem will be leverage for any non-SelectItem objects encountered.

Field Summary

Modifier and TypeField and Description
private FacesContext
private Iterator<?>
Inherited from com.sun.faces.renderkit.SelectItemsIterator.GenericObjectSelectItemIterator:
sourceComponent

Constructor Summary

AccessConstructor and Description
private
IterableItemIterator(FacesContext ctx, UISelectItems sourceComponent, Iterable<?> iterable)

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public SelectItem
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).

Inherited from com.sun.faces.renderkit.SelectItemsIterator.GenericObjectSelectItemIterator:
currentSelectComponentgetSelectItemFor

Field Detail

ctxback to summary
private FacesContext ctx
iteratorback to summary
private Iterator<?> iterator

Constructor Detail

IterableItemIteratorback to summary
private IterableItemIterator(FacesContext ctx, UISelectItems sourceComponent, Iterable<?> iterable)

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public SelectItem next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:SelectItem

the next element in the iteration

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override
com.sun.faces.renderkit back to summary

private final Class SelectItemsIterator.MapIterator

extends Object
implements SelectItemsIterator.ComponentAwareSelectItemIterator<SelectItem>
Class Inheritance
All Implemented Interfaces
com.sun.faces.renderkit.SelectItemsIterator.ComponentAwareSelectItemIterator, java.util.Iterator

Iterates over a Map of values exposing each entry as a SelectItem. Note that this will do so re-using the same SelectItem but changing the value and label as appropriate.

Field Summary

Modifier and TypeField and Description
private SelectItem
private Iterator<E>
private transient UIComponent

Constructor Summary

AccessConstructor and Description
private
MapIterator(Map<K, V> map, UIComponent parent)

Method Summary

Modifier and TypeMethod and Description
public UIComponent
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public SelectItem
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

itemback to summary
private SelectItem item
iteratorback to summary
private Iterator<E> iterator
parentback to summary
private transient UIComponent parent

Constructor Detail

MapIteratorback to summary
private MapIterator(Map<K, V> map, UIComponent parent)

Method Detail

currentSelectComponentback to summary
public UIComponent currentSelectComponent()

Implements com.sun.faces.renderkit.SelectItemsIterator.ComponentAwareSelectItemIterator.currentSelectComponent.

Annotations
@Override
hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public SelectItem next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:SelectItem

the next element in the iteration

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override
com.sun.faces.renderkit back to summary

private final Class SelectItemsIterator.SingleElementIterator

extends Object
implements SelectItemsIterator.ComponentAwareSelectItemIterator<SelectItem>
Class Inheritance
  • java.lang.Object
  • com.sun.faces.renderkit.SelectItemsIterator.SingleElementIterator
All Implemented Interfaces
com.sun.faces.renderkit.SelectItemsIterator.ComponentAwareSelectItemIterator, java.util.Iterator

Exposes single SelectItem instances as an Iterator.

Field Summary

Modifier and TypeField and Description
private SelectItem
private boolean
private transient UIComponent

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public UIComponent
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public SelectItem
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).

private void
updateItem(UIComponent selectComponent, SelectItem item)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

itemback to summary
private SelectItem item
nextCalledback to summary
private boolean nextCalled
selectComponentback to summary
private transient UIComponent selectComponent

Constructor Detail

SingleElementIteratorback to summary
private SingleElementIterator()

Method Detail

currentSelectComponentback to summary
public UIComponent currentSelectComponent()

Implements com.sun.faces.renderkit.SelectItemsIterator.ComponentAwareSelectItemIterator.currentSelectComponent.

Annotations
@Override
hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public SelectItem next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:SelectItem

the next element in the iteration

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override
updateItemback to summary
private void updateItem(UIComponent selectComponent, SelectItem item)