What if type == Path.class? ClassCastException when the methods are called?