@ SuppressWarnings ( "WeakerAccess" ) protected final void addDeclaredStereotype ( List < String > parentAnnotations , String stereotype , Map < CharSequence , Object > values ) { if ( stereotype != null ) { String repeatedName = getRepeatedName ( stereotype ) ; if ( repeatedName != null ) { Object v = values . get ( AnnotationMetadata . VALUE_MEMBER ) ; if ( v instanceof io . micronaut . core . annotation . AnnotationValue [ ] ) { io . micronaut . core . annotation . AnnotationValue [ ] avs = ( io . micronaut . core . annotation . AnnotationValue [ ] ) v ; for ( io . micronaut . core . annotation . AnnotationValue av : avs ) { addDeclaredRepeatableStereotype ( parentAnnotations , stereotype , av ) ; } } else if ( v instanceof Iterable ) { Iterable i = ( Iterable ) v ; for ( Object o : i ) { if ( o instanceof io . micronaut . core . annotation . AnnotationValue ) { addDeclaredRepeatableStereotype ( parentAnnotations , stereotype , ( io . micronaut . core . annotation . AnnotationValue ) o ) ; } } } } else { Map < String , Map < CharSequence , Object > > declaredStereotypes = getDeclaredStereotypesInternal ( ) ; Map < String , Map < CharSequence , Object > > allStereotypes = getAllStereotypes ( ) ; List < String > annotationList = getAnnotationsByStereotypeInternal ( stereotype ) ; for ( String parentAnnotation : parentAnnotations ) { if ( ! annotationList . contains ( parentAnnotation ) ) { annotationList . add ( parentAnnotation ) ; } } addAnnotation ( stereotype , values , declaredStereotypes , allStereotypes , true ) ; } } }
Adds a stereotype and its member values if the annotation already exists the data will be merged with existing values replaced .