Check if object is from certain package

java, reflection

Solution

You can check using

myInstance.getClass().getPackage()

Problem

Is there a way to check if an object's class is from a certain package? Like, when I check if an object is of a certain class using `instanceof`, I want something similar to check for a package in Java.

Original source