private void registerLocalDirectives ( Component annotation , MethodSpec . Builder initBuilder ) { try { Class < ? > [ ] componentsClass = annotation . directives ( ) ; if ( componentsClass . length > 0 ) { addGetDirectivesStatement ( initBuilder ) ; } Stream . of ( componentsClass ) . forEach ( clazz -> initBuilder . addStatement ( "directives.set($S, new $T())" , directiveToTagName ( clazz . getName ( ) ) , directiveOptionsName ( clazz ) ) ) ; } catch ( MirroredTypesException mte ) { List < DeclaredType > classTypeMirrors = ( List < DeclaredType > ) mte . getTypeMirrors ( ) ; if ( ! classTypeMirrors . isEmpty ( ) ) { addGetDirectivesStatement ( initBuilder ) ; } classTypeMirrors . forEach ( classTypeMirror -> { TypeElement classTypeElement = ( TypeElement ) classTypeMirror . asElement ( ) ; initBuilder . addStatement ( "directives.set($S, new $T())" , directiveToTagName ( classTypeElement . getSimpleName ( ) . toString ( ) ) , directiveOptionsName ( classTypeElement ) ) ; } ) ; } }
Register directives passed to the annotation .