Use StateHelper . It is accessible by UIComponent#getStateHelper() .
private enum PropertyKeys { currentPageNumber; } public void setCurrentPageNumber(int currentPageNumber) { getStateHelper().put(PropertyKeys.currentPageNumber, currentPageNumber); } public int getCurrentPageNumber() { return (int) getStateHelper().eval(PropertyKeys.currentPageNumber, 0); }
Note that I am returning the default value of 0 to getter. You can change int to Integer and remove the default value to return null .
Unrelated to a specific problem, you can simply extend the UINamingContainer instead of implementing the NamingContainer for greater simplicity. That way, you can omit the overridden getFamily() method since it is already correctly implemented using the UINamingContainer .
source share