Search in sources :

Example 6 with GeneratorFactory

use of net.morimekta.providence.generator.GeneratorFactory in project providence by morimekta.

the class HelpOption method getGenerator.

private GeneratorFactory getGenerator(ArgumentList args) {
    if (args.remaining() > 2) {
        throw new ArgumentException("Only one help spec allowed");
    }
    if (args.remaining() == 2) {
        String spec = args.get(1);
        GeneratorFactory factory = generatorFactoryMap.get().get(spec.toLowerCase());
        if (factory == null) {
            throw new ArgumentException("Unknown output language " + spec);
        }
        return factory;
    }
    return null;
}
Also used : GeneratorFactory(net.morimekta.providence.generator.GeneratorFactory) ArgumentException(net.morimekta.console.args.ArgumentException)

Aggregations

GeneratorFactory (net.morimekta.providence.generator.GeneratorFactory)6 File (java.io.File)3 ArgumentException (net.morimekta.console.args.ArgumentException)3 Generator (net.morimekta.providence.generator.Generator)3 IOException (java.io.IOException)2 GeneratorException (net.morimekta.providence.generator.GeneratorException)2 GeneratorOptions (net.morimekta.providence.generator.GeneratorOptions)2 TypeLoader (net.morimekta.providence.reflect.TypeLoader)2 ProgramParser (net.morimekta.providence.reflect.parser.ProgramParser)2 ProgramTypeRegistry (net.morimekta.providence.reflect.util.ProgramTypeRegistry)2 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 BufferedInputStream (java.io.BufferedInputStream)1 BufferedOutputStream (java.io.BufferedOutputStream)1 FileInputStream (java.io.FileInputStream)1 FileOutputStream (java.io.FileOutputStream)1 InputStream (java.io.InputStream)1 UncheckedIOException (java.io.UncheckedIOException)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1