Package jakarta.faces.model
Class ArrayDataModel<E>
java.lang.Object
jakarta.faces.model.DataModel<E>
jakarta.faces.model.ArrayDataModel<E>
- All Implemented Interfaces:
Iterable<E>
see Javadoc of Faces Specification
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturn the number of rows of data available.Return the object associated with the current row index.intGet the current row index.Get the entire collection of data associated with this component.booleanReturns true if a call to getRowData will return a valid object.voidsetRowIndex(int rowIndex) Set the current row index.voidsetWrappedData(Object data) Set the entire list of data associated with this component.Methods inherited from class jakarta.faces.model.DataModel
addDataModelListener, getDataModelListeners, iterator, removeDataModelListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ArrayDataModel
public ArrayDataModel() -
ArrayDataModel
-
-
Method Details
-
getRowCount
public int getRowCount()Description copied from class:DataModelReturn the number of rows of data available.
If the number of rows of data available is not known then -1 is returned. This may happen for DataModels that wrap sources of data such as java.sql.ResultSet that provide an iterator to access the "next item" rather than a fixed-size collection of data.
- Specified by:
getRowCountin classDataModel<E>- Returns:
- the number of rows available.
-
getRowData
Description copied from class:DataModelReturn the object associated with the current row index.Method isRowAvailable may be called before attempting to access this method, to ensure that the data is available.
- Specified by:
getRowDatain classDataModel<E>- Returns:
- The object associated with the current row index.
-
getRowIndex
public int getRowIndex()Description copied from class:DataModelGet the current row index.- Specified by:
getRowIndexin classDataModel<E>- Returns:
- The current row index.
-
getWrappedData
Description copied from class:DataModelGet the entire collection of data associated with this component. Note that the actual type of the returned object depends upon the concrete subclass of DataModel; the object will represent an "ordered sequence of components", but may be implemented as an array, java.util.List, java.sql.ResultSet or other similar types.- Specified by:
getWrappedDatain classDataModel<E>- Returns:
- the wrapped object.
-
isRowAvailable
public boolean isRowAvailable()Description copied from class:DataModelReturns true if a call to getRowData will return a valid object.- Specified by:
isRowAvailablein classDataModel<E>- Returns:
- true if a call to getRowData will return a valid object. false otherwise.
-
setRowIndex
public void setRowIndex(int rowIndex) Description copied from class:DataModelSet the current row index. This affects the behaviour of the getRowData method in particular.- Specified by:
setRowIndexin classDataModel<E>- Parameters:
rowIndex- The row index. It may be -1 to indicate "no row", or may be a value between 0 and getRowCount()-1.
-
setWrappedData
Description copied from class:DataModelSet the entire list of data associated with this component. Note that the actual type of the provided object must match the expectations of the concrete subclass of DataModel. See getWrappedData.- Specified by:
setWrappedDatain classDataModel<E>- Parameters:
data- The object to be wrapped.
-