University of Cincinnati logo and link  
Indexed Properties
 
  UC ingot Indexed properties gets or sets an array.
  • Indexed properties have two getters and setters, one for the array itself and one for its elements.
    • These getters and setters would likely have the same name, but with different parameter types.
    • For example, consider a read-only result set.  We could have:

    • public ResultSet getResults()
      and
      public String getResult(int row, int column)
      Where the first method would get the entire result set, and the second method would get a specific row-column String.  Remember, with ResultSets, it is farily easy to get values as Strings.
    • We could set the SQL strings in a similar way.

    • public void setSQLString(String SQLString)
      would add or set one element in an array of SQLStrings,
      public void setSQLString(String SQLString, int i)
      would add or set one element in an array of SQLStrings at a specified position, and, 
      public void setSQLString(String[] SQLString)
      would set the entire array of SQLStrings.
  • What does this buy us?
    • The programmer can choose the most appropriate level of complexity, from getting simple values to getting entire result sets.
  • Keep in mind...
    • The normal ground rules apply.  Method signatures cannot be differentiated by the return type alone, they must be unique by their implicit parameters and/or method names.

    •  
     Bound Properties