Generate AnnotationTypes and refactor some codes