Skip to content

Commit adf578e

Browse files
thelsingadrienbaron
authored andcommitted
add methods as form interfaces too.
1 parent d5bc8ef commit adf578e

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

processors/src/main/java/com/axellience/vuegwt/processors/component/template/ComponentTemplateProcessor.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.axellience.vuegwt.processors.component.template;
22

3-
import static com.axellience.vuegwt.processors.utils.ComponentGeneratorsUtil.getComponentLocalComponents;
4-
import static com.axellience.vuegwt.processors.utils.ComponentGeneratorsUtil.getSuperComponentType;
3+
import static com.axellience.vuegwt.processors.utils.ComponentGeneratorsUtil.*;
54
import static com.axellience.vuegwt.processors.utils.GeneratorsNameUtil.componentToTagName;
65
import static com.axellience.vuegwt.processors.utils.GeneratorsNameUtil.computedPropertyNameToFieldName;
76
import static com.axellience.vuegwt.processors.utils.GeneratorsUtil.getComputedPropertyName;
@@ -175,6 +174,13 @@ private void registerFieldsAndMethodsInContext(TemplateParserContext templatePar
175174
superComponent,
176175
alreadyDoneVariable,
177176
alreadyDoneMethods));
177+
178+
getInterfaceTypes(componentTypeElement)
179+
.forEach(iface -> registerFieldsAndMethodsInContext(
180+
templateParserContext,
181+
iface,
182+
alreadyDoneVariable,
183+
alreadyDoneMethods));
178184
}
179185

180186
/**

processors/src/main/java/com/axellience/vuegwt/processors/utils/ComponentGeneratorsUtil.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,23 @@ public static Optional<TypeElement> getSuperComponentType(TypeElement component)
193193
return Optional.of((TypeElement) ((DeclaredType) component.getSuperclass()).asElement());
194194
}
195195

196+
/**
197+
* Return the {@link TypeElement}s of the interfaces of a given {@link
198+
* IsVueComponent}. If the {@link IsVueComponent} has not interfaces,
199+
* return an empty {@link List}
200+
*
201+
* @param component The {@link IsVueComponent} to get the super type of
202+
* @return The List of {@link TypeElement}s of the interfaces or an empty.
203+
*/
204+
public static List<TypeElement> getInterfaceTypes(TypeElement component) {
205+
List<TypeElement> interfaceElements = new LinkedList<>();
206+
for (TypeMirror m : component.getInterfaces()) {
207+
interfaceElements.add((TypeElement) ((DeclaredType) m).asElement());
208+
}
209+
return interfaceElements;
210+
}
211+
212+
196213
/**
197214
* Return the number of super component in the chain of parents
198215
*

0 commit comments

Comments
 (0)