public void generate ( TypeElement directiveTypeElement ) { ClassName optionsClassName = GeneratorsNameUtil . directiveOptionsName ( directiveTypeElement ) ; Builder componentClassBuilder = TypeSpec . classBuilder ( optionsClassName ) . addModifiers ( Modifier . PUBLIC , Modifier . FINAL ) . superclass ( VueDirectiveOptions . class ) . addAnnotation ( JsType . class ) . addJavadoc ( "VueComponent Directive Options for directive {@link $S}" , directiveTypeElement . getQualifiedName ( ) . toString ( ) ) ; // Initialize constructor MethodSpec . Builder constructorBuilder = MethodSpec . constructorBuilder ( ) . addModifiers ( Modifier . PUBLIC ) ; // Add the Java Component Instance initialization constructorBuilder . addStatement ( "this.$L = new $T()" , "vuegwt$javaDirectiveInstance" , TypeName . get ( directiveTypeElement . asType ( ) ) ) ; // Call the method to copy hooks functions constructorBuilder . addStatement ( "this.copyHooks()" ) ; // Finish building the constructor componentClassBuilder . addMethod ( constructorBuilder . build ( ) ) ; // Build the DirectiveOptions class GeneratorsUtil . toJavaFile ( filer , componentClassBuilder , optionsClassName , directiveTypeElement ) ; }
Generate and save the Java file for the typeElement passed to the constructor