io.joynr.generator.proxy.InterfaceProxyTemplate Maven / Gradle / Ivy
The newest version!
package io.joynr.generator.proxy;
import com.google.inject.Inject;
import io.joynr.generator.templates.InterfaceTemplate;
import io.joynr.generator.templates.util.NamingUtil;
import io.joynr.generator.util.JoynrJavaGeneratorExtensions;
import io.joynr.generator.util.TemplateBase;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.Extension;
@SuppressWarnings("all")
public class InterfaceProxyTemplate extends InterfaceTemplate {
@Inject
@Extension
private JoynrJavaGeneratorExtensions _joynrJavaGeneratorExtensions;
@Inject
@Extension
private NamingUtil _namingUtil;
@Inject
@Extension
private TemplateBase _templateBase;
@Override
public CharSequence generate(final boolean generateVersion) {
CharSequence _xblockexpression = null;
{
final String interfaceName = this._namingUtil.joynrName(this.francaIntf);
final String className = this._joynrJavaGeneratorExtensions.getProxyClassName(this.francaIntf);
final String asyncClassName = (interfaceName + "Async");
final String statelessAsyncClassName = (interfaceName + "StatelessAsync");
final String syncClassName = (interfaceName + "Sync");
final String subscriptionClassName = (interfaceName + "SubscriptionInterface");
final String broadcastClassName = (interfaceName + "BroadcastInterface");
final String packagePath = this._joynrJavaGeneratorExtensions.getPackagePathWithJoynrPrefix(this.francaIntf, ".", generateVersion);
StringConcatenation _builder = new StringConcatenation();
_builder.newLine();
CharSequence _warning = this._templateBase.warning();
_builder.append(_warning);
_builder.newLineIfNotEmpty();
_builder.append("package ");
_builder.append(packagePath);
_builder.append(";");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("import io.joynr.JoynrVersion;");
_builder.newLine();
_builder.newLine();
_builder.append("@JoynrVersion(major = ");
_builder.append(this.majorVersion);
_builder.append(", minor = ");
_builder.append(this.minorVersion);
_builder.append(")");
_builder.newLineIfNotEmpty();
_builder.append("public interface ");
_builder.append(className);
_builder.append(" extends ");
_builder.append(asyncClassName);
_builder.append(", ");
_builder.append(statelessAsyncClassName);
_builder.append(", ");
_builder.append(syncClassName);
{
int _size = this.francaIntf.getAttributes().size();
boolean _greaterThan = (_size > 0);
if (_greaterThan) {
_builder.append(", ");
_builder.append(subscriptionClassName);
}
}
{
int _size_1 = this.francaIntf.getBroadcasts().size();
boolean _greaterThan_1 = (_size_1 > 0);
if (_greaterThan_1) {
_builder.append(", ");
_builder.append(broadcastClassName);
}
}
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("public static String INTERFACE_NAME = \"");
String _fullyQualifiedName = this._joynrJavaGeneratorExtensions.getFullyQualifiedName(this.francaIntf);
_builder.append(_fullyQualifiedName, "\t");
_builder.append("\";");
_builder.newLineIfNotEmpty();
_builder.append("}");
_builder.newLine();
_xblockexpression = _builder;
}
return _xblockexpression;
}
}