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.EnumTemplate;
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.eclipse.xtext.xbase.lib.StringExtensions;
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 EnumTemplate 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 _name = type.getName();
        String _firstUpper = StringExtensions.toFirstUpper(_name);
        String _plus = (path + _firstUpper);
        String _plus_1 = (_plus + ".java");
        CharSequence _generate = this.complexTypeTemplate.generate(((FCompoundType) type));
        String _string = _generate.toString();
        fsa.generateFile(_plus_1, _string);
      }
    }
    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);
        String _name_1 = type_1.getName();
        String _firstUpper_1 = StringExtensions.toFirstUpper(_name_1);
        String _plus_2 = (path_1 + _firstUpper_1);
        String _plus_3 = (_plus_2 + ".java");
        CharSequence _generate_1 = this.enumTemplate.generate(((FEnumerationType) type_1));
        String _string_1 = _generate_1.toString();
        fsa.generateFile(_plus_3, _string_1);
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy