aspose file tools*
The moose likes Java in General and the fly likes Quick question about JavaBeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Quick question about JavaBeans" Watch "Quick question about JavaBeans" New topic
Author

Quick question about JavaBeans

Brian Legg
Ranch Hand

Joined: Nov 07, 2008
Posts: 488
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?

Thank you!


SCJA
~Currently preparing for SCJP6
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
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?"
Brian Legg
Ranch Hand

Joined: Nov 07, 2008
Posts: 488
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.
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
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
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
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 ]
Brian Legg
Ranch Hand

Joined: Nov 07, 2008
Posts: 488
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 ]
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Good luck on your test!
Brian Legg
Ranch Hand

Joined: Nov 07, 2008
Posts: 488
Heh, I meant on the forums James

I'm not in school, so no tests for me!
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
It looks like you are preparing for the SCJP6 test, currently. If so, good luck on the test
[ December 15, 2008: Message edited by: James Clark ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Quick question about JavaBeans