Search in sources :

Example 1 with JavaInterfaceSource

use of org.jboss.forge.roaster.model.source.JavaInterfaceSource in project Entitas-Java by Rubentxu.

the class ComponentIndicesGenerator method addComponentFactories.

public void addComponentFactories(ComponentInfo[] componentInfos, JavaClassSource javaClass) {
    String format = " %1$s.class,\n";
    String code = "return new FactoryComponent[] {";
    for (int i = 0; i < componentInfos.length; i++) {
        ComponentInfo info = componentInfos[i];
        JavaInterfaceSource interfaceSource = Roaster.parse(JavaInterfaceSource.class, String.format("public interface Factory%1$s extends FactoryComponent {}", info.typeName));
        interfaceSource.addMethod().setName(String.format("create%1$s", info.typeName)).setReturnType(info.typeName).setPublic();
        javaClass.addNestedType(interfaceSource.toString());
    }
}
Also used : JavaInterfaceSource(org.jboss.forge.roaster.model.source.JavaInterfaceSource) ComponentInfo(com.ilargia.games.entitas.codeGenerator.data.ComponentInfo)

Aggregations

ComponentInfo (com.ilargia.games.entitas.codeGenerator.data.ComponentInfo)1 JavaInterfaceSource (org.jboss.forge.roaster.model.source.JavaInterfaceSource)1