Reputation: 3518
How do I organize my Java Eclipse project so that the user then only needs to do one import?
I am working on a graphics library and I have various package in it like graphics.A, graphics.B, etc. but when I give this library to the user I want him to be able to use it just by saying import graphics for example. I am not sure how to do that. The way I have it now he would have to do import graphics.A., import graphics.B., etc.
Thanks
Upvotes: 3
Views: 102
Reputation: 171
Well, tooling should take care of managing the imports. I'm not sure why having a single import is of any importance, but I can't know your motivations, so I'll just accept it.
Upvotes: 2
Reputation: 9579
Importing all subpackages with single line is impossible in Java.
import graphics.*;
would import only classes in graphics
, graphics.A
and graphics.B
would not be imported, if A
and B
are subpackages.
So either put all your classes in one subpackage, or user would have to import more than once like
import graphics.A.*;
import graphics.B.*;
Upvotes: 5