Questions tagged [indexed-properties]

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 called testGrades:

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;
}
35 questions
0
votes
1 answer

Using stripes indexed properties to populate a map

Hope you can help me find an answer to problem that's been keeping me busy 2 days already. I'm building an app for making theater-reservations as part of a Java course i've been following. I'm trying to use the stripes index feature to populate a…
Jos Brunink
  • 1
  • 1
  • 4
0
votes
2 answers

What does Resharper have against the commonly-used getRange() in Excel Interop?

Almost all of the example code online for C# Excel interop has stuff like this: monthlyChartRange = _xlSheetChart.get_Range("A3", "C4"); Yet, Resharper turns up its nose at it and demands: "Use indexed property" If you accede to its wishes (and I…
0
votes
0 answers

How can I validate indexed properties of JavaBean with Hibernate validator?

I have an indexed property such as private int[] indexedProperty; According to spec I should provide indexed accessors. Would constraints declared on these accessors be valid? Should I also provide array accessors and declare @Valid constraint on…
0
votes
1 answer

PropertyChanged for multiple index values

To raise a PropertyChanged event for an indexer and a particular index value, do this: OnPropertyChanged(string.Format(CultureInfo.CurrentCulture, "Item[{0}]", indexValue)); But what if the indexer accepts multiple index values? Rather than…
0
votes
1 answer

How do bind indexed property to jface viewer

I want to bind an indexed property to JFace ComboViewer. Lets say that I have a DataModel class like this: class DataModel { private String[] props = {"A","B","C"}; private PropertyChangeSupport pcs = new PropertyChangeSupport(this); …
mariha
  • 3
  • 2
1 2
3