public <T extends Pet> T toPet(String pet, @TargetType Class<T> clazz) throws CatException, DogException {
if ( clazz == IndoorPet.class ) {
return (T) new IndoorPet( toPet( pet ) );
}
if ( clazz == OutdoorPet.class ) {
return (T) new OutdoorPet( toPet( pet ) );
}
return null;
}