001package net.gdface.codegen.webclient; 002 003import org.apache.commons.cli.Options; 004 005import net.gdface.cli.Context; 006import net.gdface.codegen.generator.GeneratorConfiguration; 007 008public class StubClientGenerator extends WebClientGenerator { 009 private final StubClientOptions options = StubClientOptions.getInstance(); 010 protected StubClientConfiguration config = new StubClientConfiguration(); 011 012 public StubClientGenerator() { 013 config = new StubClientConfiguration(); 014 } 015 016 public static void main(String[] args) { 017 new StubClientGenerator().parseCommandLine(args).initEngine().generate(); 018 } 019 020 @SuppressWarnings({ "unchecked", "rawtypes" }) 021 @Override 022 protected Context createEngineContext() { 023 Context context = super.createEngineContext(); 024 StubClient newSourceInfo = new StubClient(config.getInterfaceClass(), config.getRefClass(), 025 config.getServiceClass(), config.getStubPackage()); 026 if (!newSourceInfo.compile()) 027 System.exit(1); 028 context.setProperty(SOURCE_INFO, newSourceInfo); 029 return context; 030 } 031 032 @Override 033 protected Options getOptions() { 034 return options.getOptions(); 035 } 036 037 @Override 038 protected GeneratorConfiguration getGeneratorConfiguration() { 039 return config; 040 } 041 042}