the java api object that I mentioned can contain factory methods and helpers for checking instance type and casting