This was the closest forum I could find to post this question. Mods, if you don't agree, please move it where you think it belongs. Thanks!
I am taking an IBM online course and it states: "An indexed property represents a range of values that the property may hold. This range of values is held in an array."
This is in reference to JavaBeans which are picky about small details so I was wondering... Do ranges of values HAVE to be stored in an array to have a properly formed JavaBean? Can't you use one of the collection APIs?
Does the material in the online course explicilty state that "in order to have a properly formed JavaBean, a range of values must be stored in an array?"
Joined: Nov 07, 2008
It does not say that explicitly, but it also does not say you can use another form of collection. From the above quote, "This range of values is held in an array." <-- It doesn't say "array or some other collection type" so I want to make sure about this.
This is more a question about the Java Bean specification than about design in general - moving to Java in General.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Joined: Apr 16, 2008
You are adding too much "hypothesis" to the statement. The indice structure of an Java-based array does not apply to the Collection class, it's implementation classes, or the objects stored in a collection. However, this is not directly related to the JavaBean format.
There is a "context" missing from your first post. You did not explain clearly how the sentence you quoted relates to correctly implementing a JavaBean according to the specification. The sentence is simply conveying the indice structure of an array and explaining what an indexed property means. There is no mention of Java Collections in the sentence.
You can store a "range of values" in a Collection, in the form of objects. However, this is not indexed the way a Java-based array is. Maybe at a deep, implementation level, but not something the application programmer programs with in the API.
Below is a example of a valid JavaBean.
[ December 15, 2008: Message edited by: James Clark ]
Joined: Nov 07, 2008
Thanks for the reply James... that answers my question!
ps: Looks like I graduated... my stuff is now getting moved to intermediate section instead of beginners section [ December 15, 2008: Message edited by: Brian Legg ]