Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exceptions visibility

 
Tomasz Luchowski
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm working on URLyBird and I am not sure what is the "right" visiblity of exceptions defined in suncertify.db. My specification says "Any unimplemented exceptions in this interface must all be created as member classes of the suncertify.db package". Does "member class" mean it is a class with package-private visibility, or does it simply mean it is a class defined in given package, any does not say anything about the expected visibility?

I believe it's the latter but just wanted to make sure I don't miss anything.

Regards,
Tomasz
 
Paul Anilprem
Enthuware Software Support
Ranch Hand
Posts: 3669
9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tomasz Luchowski:
Hello,

I'm working on URLyBird and I am not sure what is the "right" visiblity of exceptions defined in suncertify.db. My specification says "Any unimplemented exceptions in this interface must all be created as member classes of the suncertify.db package". Does "member class" mean it is a class with package-private visibility, or does it simply mean it is a class defined in given package, any does not say anything about the expected visibility?

I believe it's the latter but just wanted to make sure I don't miss anything.

Regards,
Tomasz


You are right, they should just be member of the db package. Usually, business logic in implemented in another server package. Since this business package uses db layer (i.e. db package), classes (including exceptions) that form an interface (as in concept not java interface) of the db package have to be public as well.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic