refactoring common code for annotation types