• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX: (Contractors) Interface confusion SOS

 
Zhi Gang
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the interface DB has the below method. I have manage to implement the method in Data.java. However when i start writing for the user interface, i don't see why it needs to return a int[] of record No. rather then a List of String[]
- - - - - - - - - - - - - - - - - - - - - - -
Returns an array of record no that match the specified criteria.
public int[] find(String[] criteria);
- - - - - - - - - - - - - - - - - - - - - - -
Therefore i decided to add another method in the Data class.
Public List getSomeRec(String[] criteria){
blar..
int [] listRecNo = this.find(criteria)
blar...
return someRecord;
}
===========================================
Somehow i am not 100% convince that is allow, please could any one help me, let me know what u think...
 
Perry Board
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you want to return an array of Strings? The method is documented as returning an array of "record numbers" so it would be an integer array. The read method would take one of these ints to return a single record.
 
Zhi Gang
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply, yes... you are right, that is what i think, to return it in a String[] sigle record OR list of String[] records, if they found more then one record).
- - - - - - - - - - - - - - - - - - - - -- - -
Public List getSomeRec(String[] criteria){
blar..
int [] arrayRecNo = this.find(criteria)
blar..
String[] record = this.read(recNo)
add this to arrayList of someRecord
return someRecord;
}
- - - - - - - - - - - - - - - - - - - - - - -
Another question, then find method will only called in Data by its own method and it will not appear in GUI lever right? ( coz it make no sense to reply a list of int[] recNo to the Jtable).
i really hope that i am in the right track...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic