• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

UrlyBird 1.3.3 find method

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everybody.

guys i have some questions about my find method:

// Returns an array of record numbers that match the specified
// criteria. Field n in the database file is described by
// criteria[n]. A null value in criteria[n] matches any field
// value. A non-null value in criteria[n] matches any field
// value that begins with criteria[n]. (For example, "Fred"
// matches "Fred" or "Freddy".)
public int [] find(String [] criteria) throws RecordNotFoundException;

1. in my implementation when the size of the "criteria" is > 0 then i return the record that match
for any criteria. Is this right ? Someone used regular expression in this method?

2. in this method the sun interface only throw RecordNotFoundException, but in my implementation i
have to read the data file, so may i have to throw an IOException too. Can add more exception for my method?
i have the same doubt about create, read, modify and delete methods...


thanks,
 
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fala ai Thiago!

For your first question, please take a look here. I think this will be helpful!

For your second question, it probably will be better to throw a RuntimeException in these cases. Unfortunatelly, you can't change the interface that was provided to you. So just throw the exceptions that are allowed.

Will Sport be the Libertadores champion this year?!?!?!
 
Thiago Melo
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fala Roberto,
thanks for tip, about the exceptions i don't have doubts anymore. but the find method i'm a little confused. Because if i understand well, first i will do a search with the "OR" logic, and latter i'll filter in my gui. Am i right?

P.S Someone hold my sport!!! heheheh
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thiago Melo wrote:Fala Roberto,
Because if i understand well, first i will do a search with the "OR" logic, and latter i'll filter in my gui. Am i right?



You are absolutely right!
 
I'm all tasted up for a BLT! This tiny ad wants a monte cristo!
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic