Properties of a Java Bean that could be accessed via index.
Properties of a Java Bean that could be accesses via index. Usually such property is a collection like a List
, or Map
, or array. Both collections have an index/key that could be used as a property accessor.
Here's how it's used in the Java Tutorial:
Indexed Properties
An indexed property is an array instead of a single value. In this case, the bean class provides a method for getting and setting the entire array. Here is an example for an
int[]
property calledtestGrades
:public int[] getTestGrades() { return mTestGrades; } public void setTestGrades(int[] tg) { mTestGrades = tg; }
For indexed properties, the bean class also provides methods for getting and setting a specific element of the array.
public int getTestGrades(int index) { return mTestGrades[index]; } public void setTestGrades(int index, int grade) { mTestGrades[index] = grade; }