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

io.joynr.generator.communicationmodel.CommunicationModelGenerator Maven / Gradle / Ivy

There is a newer version: 0.9.3
Show newest version
package io.joynr.generator.communicationmodel;

import com.google.inject.Inject;
import io.joynr.generator.communicationmodel.ComplexTypeTemplate;
import io.joynr.generator.communicationmodel.EnumTypeTemplate;
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.FCompoundType;
import org.franca.core.franca.FEnumerationType;
import org.franca.core.franca.FModel;
import org.franca.core.franca.FType;

@SuppressWarnings("all")
public class CommunicationModelGenerator {
  @Inject
  @Extension
  private JoynrJavaGeneratorExtensions _joynrJavaGeneratorExtensions;
  
  @Inject
  private EnumTypeTemplate enumTemplate;
  
  @Inject
  private ComplexTypeTemplate complexTypeTemplate;
  
  public void doGenerate(final FModel fModel, final IFileSystemAccess fsa) {
    Iterable _complexDataTypes = this._joynrJavaGeneratorExtensions.getComplexDataTypes(fModel);
    for (final FType type : _complexDataTypes) {
      if ((type instanceof FCompoundType)) {
        String _packagePathWithJoynrPrefix = this._joynrJavaGeneratorExtensions.getPackagePathWithJoynrPrefix(type, File.separator);
        final String path = (_packagePathWithJoynrPrefix + File.separator);
        String _joynrName = this._joynrJavaGeneratorExtensions.joynrName(type);
        String _plus = (path + _joynrName);
        String _plus_1 = (_plus + ".java");
        this._joynrJavaGeneratorExtensions.generateFile(fsa, _plus_1, 
          this.complexTypeTemplate, ((FCompoundType)type));
      }
    }
    Iterable _enumDataTypes = this._joynrJavaGeneratorExtensions.getEnumDataTypes(fModel);
    for (final FType type_1 : _enumDataTypes) {
      {
        String _packagePathWithJoynrPrefix_1 = this._joynrJavaGeneratorExtensions.getPackagePathWithJoynrPrefix(type_1, File.separator);
        final String path_1 = (_packagePathWithJoynrPrefix_1 + File.separator);
        if ((type_1 instanceof FEnumerationType)) {
          String _joynrName_1 = this._joynrJavaGeneratorExtensions.joynrName(type_1);
          String _plus_2 = (path_1 + _joynrName_1);
          String _plus_3 = (_plus_2 + ".java");
          this._joynrJavaGeneratorExtensions.generateFile(fsa, _plus_3, 
            this.enumTemplate, ((FEnumerationType)type_1));
        }
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy