Search in sources :

Example 1 with GeneratorCreationException

use of org.eclipse.vorto.codegen.gateway.exception.GeneratorCreationException in project vorto by eclipse.

the class Generator method create.

public static Generator create(String configFile, Class<? extends IVortoCodeGenerator> generatorClass, IGeneratorConfigUITemplate configTemplate) {
    Objects.requireNonNull(configFile);
    Objects.requireNonNull(generatorClass);
    Objects.requireNonNull(configTemplate);
    try {
        IVortoCodeGenerator instance = generatorClass.newInstance();
        return new Generator(GatewayUtils.generatorInfoFromFile(configFile, instance), instance, configTemplate);
    } catch (Exception e) {
        throw new GeneratorCreationException("Error in instantiating Generator", e);
    }
}
Also used : IVortoCodeGenerator(org.eclipse.vorto.codegen.api.IVortoCodeGenerator) GeneratorCreationException(org.eclipse.vorto.codegen.gateway.exception.GeneratorCreationException) GeneratorCreationException(org.eclipse.vorto.codegen.gateway.exception.GeneratorCreationException) IVortoCodeGenerator(org.eclipse.vorto.codegen.api.IVortoCodeGenerator)

Aggregations

IVortoCodeGenerator (org.eclipse.vorto.codegen.api.IVortoCodeGenerator)1 GeneratorCreationException (org.eclipse.vorto.codegen.gateway.exception.GeneratorCreationException)1