All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.joynr.generator.provider.ProviderGenerator Maven / Gradle / Ivy

The newest version!
package io.joynr.generator.provider;

import com.google.inject.Inject;
import io.joynr.generator.templates.util.NamingUtil;
import io.joynr.generator.util.JavaTemplateFactory;
import io.joynr.generator.util.JoynrJavaGeneratorExtensions;
import java.io.File;
import org.eclipse.xtext.generator.IFileSystemAccess;
import org.eclipse.xtext.xbase.lib.Extension;
import org.franca.core.franca.FInterface;

@SuppressWarnings("all")
public class ProviderGenerator {
  @Inject
  @Extension
  private JoynrJavaGeneratorExtensions _joynrJavaGeneratorExtensions;

  @Inject
  @Extension
  private NamingUtil _namingUtil;

  @Inject
  private JavaTemplateFactory templateFactory;

  public void doGenerate(final FInterface fInterface, final IFileSystemAccess fsa, final boolean generateVersion) {
    String _packagePathWithJoynrPrefix = this._joynrJavaGeneratorExtensions.getPackagePathWithJoynrPrefix(fInterface, File.separator, generateVersion);
    final String path = (_packagePathWithJoynrPrefix + File.separator);
    String serviceName = this._namingUtil.joynrName(fInterface);
    InterfaceProviderTemplate interfaceProviderTemplate = this.templateFactory.createInterfaceProviderTemplate(fInterface);
    this._joynrJavaGeneratorExtensions.generateFile(fsa, 
      ((path + serviceName) + "Provider.java"), interfaceProviderTemplate, generateVersion);
    DefaultInterfaceProviderTemplate defaultInterfaceProviderTemplate = this.templateFactory.createDefaultInterfaceProviderTemplate(fInterface);
    this._joynrJavaGeneratorExtensions.generateFile(fsa, 
      (((path + "Default") + serviceName) + "Provider.java"), defaultInterfaceProviderTemplate, generateVersion);
    InterfaceAbstractProviderTemplate interfaceAbstractProviderTemplate = this.templateFactory.createInterfaceAbstractProviderTemplate(fInterface);
    this._joynrJavaGeneratorExtensions.generateFile(fsa, 
      ((path + serviceName) + "AbstractProvider.java"), interfaceAbstractProviderTemplate, generateVersion);
    InterfaceSubscriptionPublisherTemplate subscriptionPublisherTemplate = this.templateFactory.createSubscriptionPublisherTemplate(fInterface);
    this._joynrJavaGeneratorExtensions.generateFile(fsa, 
      ((path + serviceName) + "SubscriptionPublisher.java"), subscriptionPublisherTemplate, generateVersion);
    InterfaceSubscriptionPublisherImplTemplate subscriptionPublisherImplTemplate = this.templateFactory.createSubscriptionPublisherImplTemplate(fInterface);
    this._joynrJavaGeneratorExtensions.generateFile(fsa, 
      ((path + serviceName) + "SubscriptionPublisherImpl.java"), subscriptionPublisherImplTemplate, generateVersion);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy