Search in sources :

Example 1 with ClientGenerator

use of com.robotoworks.mechanoid.net.generator.ClientGenerator in project mechanoid by robotoworks.

the class NetModelGenerator method _generate.

protected void _generate(final Client client, final Model model, final IFileSystemAccess fsa) {
    String _packageName = model.getPackageName();
    String _name = client.getName();
    String _plus = ("Abstract" + _name);
    String _resolveFileName = Strings.resolveFileName(_packageName, _plus);
    ClientGenerator _get = this.mClientGenerator.get();
    CharSequence _generate = _get.generate(client, model);
    fsa.generateFile(_resolveFileName, _generate);
    String _packageName_1 = model.getPackageName();
    String _name_1 = client.getName();
    String _resolveFileName_1 = Strings.resolveFileName(_packageName_1, _name_1);
    ClientGenerator _get_1 = this.mClientGenerator.get();
    CharSequence _generateStub = _get_1.generateStub(client, model);
    fsa.generateFile(_resolveFileName_1, MechanoidOutputConfigurationProvider.DEFAULT_STUB_OUTPUT, _generateStub);
    String _packageName_2 = model.getPackageName();
    String _name_2 = client.getName();
    String _pascalize = Strings.pascalize(_name_2);
    String _concat = _pascalize.concat("ReaderProvider");
    String _plus_1 = ("Default" + _concat);
    String _resolveFileName_2 = Strings.resolveFileName(_packageName_2, _plus_1);
    EntityReaderProviderGenerator _get_2 = this.mEntityReaderProviderGenerator.get();
    CharSequence _generate_1 = _get_2.generate(client, model);
    fsa.generateFile(_resolveFileName_2, _generate_1);
    String _packageName_3 = model.getPackageName();
    String _name_3 = client.getName();
    String _pascalize_1 = Strings.pascalize(_name_3);
    String _concat_1 = _pascalize_1.concat("WriterProvider");
    String _plus_2 = ("Default" + _concat_1);
    String _resolveFileName_3 = Strings.resolveFileName(_packageName_3, _plus_2);
    EntityWriterProviderGenerator _get_3 = this.mEntityWriterProviderGenerator.get();
    CharSequence _generate_2 = _get_3.generate(client, model);
    fsa.generateFile(_resolveFileName_3, _generate_2);
    EList<ClientBlock> _blocks = client.getBlocks();
    Iterable<HttpMethod> _filter = Iterables.<HttpMethod>filter(_blocks, HttpMethod.class);
    final Consumer<HttpMethod> _function = new Consumer<HttpMethod>() {

        public void accept(final HttpMethod method) {
            String _packageName = model.getPackageName();
            String _name = method.getName();
            String _pascalize = Strings.pascalize(_name);
            String _concat = _pascalize.concat("Request");
            String _resolveFileName = Strings.resolveFileName(_packageName, _concat);
            RequestGenerator _get = NetModelGenerator.this.mRequestGenerator.get();
            CharSequence _generate = _get.generate(method, model, client);
            fsa.generateFile(_resolveFileName, _generate);
            String _packageName_1 = model.getPackageName();
            String _name_1 = method.getName();
            String _pascalize_1 = Strings.pascalize(_name_1);
            String _concat_1 = _pascalize_1.concat("Result");
            String _resolveFileName_1 = Strings.resolveFileName(_packageName_1, _concat_1);
            ResultGenerator _get_1 = NetModelGenerator.this.mResultGenerator.get();
            CharSequence _generate_1 = _get_1.generate(method, model, client);
            fsa.generateFile(_resolveFileName_1, _generate_1);
        }
    };
    _filter.forEach(_function);
}
Also used : ClientGenerator(com.robotoworks.mechanoid.net.generator.ClientGenerator) EntityReaderProviderGenerator(com.robotoworks.mechanoid.net.generator.EntityReaderProviderGenerator) EntityWriterProviderGenerator(com.robotoworks.mechanoid.net.generator.EntityWriterProviderGenerator) ClientBlock(com.robotoworks.mechanoid.net.netModel.ClientBlock) ResultGenerator(com.robotoworks.mechanoid.net.generator.ResultGenerator) Consumer(java.util.function.Consumer) RequestGenerator(com.robotoworks.mechanoid.net.generator.RequestGenerator) HttpMethod(com.robotoworks.mechanoid.net.netModel.HttpMethod)

Aggregations

ClientGenerator (com.robotoworks.mechanoid.net.generator.ClientGenerator)1 EntityReaderProviderGenerator (com.robotoworks.mechanoid.net.generator.EntityReaderProviderGenerator)1 EntityWriterProviderGenerator (com.robotoworks.mechanoid.net.generator.EntityWriterProviderGenerator)1 RequestGenerator (com.robotoworks.mechanoid.net.generator.RequestGenerator)1 ResultGenerator (com.robotoworks.mechanoid.net.generator.ResultGenerator)1 ClientBlock (com.robotoworks.mechanoid.net.netModel.ClientBlock)1 HttpMethod (com.robotoworks.mechanoid.net.netModel.HttpMethod)1 Consumer (java.util.function.Consumer)1