public static boolean isAllowedToCall(){
String callerClassName= new Throwable().getStackTrace()[2].getClassName();
return (callerClassName.startsWith("com.gorbas")||callerClassName.contains("binding"));
}
In my case I allow only packages starting with com.gorbas and classes that contain the word "binding" in their full name.