Limit access of a java class to some packages
<p>I have a <code>Java</code> class which have some confidential information which I don't want to provide to any unauthorized class.<br/></p>

<p>I want to access this class in some packages (classes from this packages are going to utilize confidential information), So that my secure class should be accessible in these packages.</p>

<p>Is there any way where I can check if caller of method is a authorized class from authorized package or not?</p>

<p>I know public/private/default all things (so please don't ask me to use it), but those are not useful here, because I want a class to be accessible in some packages(not one/same).</p>
