• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MVC *BEANS*

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a kind of design question. When coding standard Java Beans(With Indexed Properties) is there a problem with using a collection (I.E. ArrayList) vs using a standard array. The reason is: I am creating a DataBean that accesses a DB and holds an indexed result set and I do not know the number of rows at Instanciation time. Also i need will need to do sorting in the future. Is this ok or will one of my colleges slash my tires because they have to maintain this later?
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Heath",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please choose a new name which meets the requirements.
Thanks.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you'll be safe as long as you also provide a bean-accessible version of the "size" method of the collection, so anyone using the bean can limit their indexing. I'd also recommend exporting the "iterator" method of the collection so that a user of the class can work that way if they want to.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic