blob: 02d30a15a1c3dba379cc2cd8878ab95a9324b0ce [file] [log] [blame]
import org::eclipse::xtend::backend::aop;
import org::eclipse::xtend::backend::common;
import org::eclipse::xtend::backend::expr;
import org::eclipse::xtend::backend::compiler;
import org::eclipse::xtend::backend::compiler::model;
import org::eclipse::xtend::backend::functions;
extension org::eclipse::xtend::backend::compiler::templates::expressions;
extension org::eclipse::xtend::backend::compiler::templates::functions;
String generateVarName (String baseVarName) :
JAVA org.eclipse.xtend.backend.compiler.templates.VarNameGeneratorExpressions.generateVarName (java.lang.String);
int getNextVarIdx () :
JAVA org.eclipse.xtend.backend.compiler.templates.VarNameGeneratorExpressions.getNextVarIdx ();
String toCompiledResourceClassName (String resourceName) : (resourceName.stripFilenamePostfix().replaceAll ("::","/").split("\\/").last());
String toCompiledResourceFileName (String resourceName) : (resourceName.stripFilenamePostfix().replaceAll ("::","/"));
String toCompiledResourcePackageName (String resourceName) : resourceName.stripFilenamePostfix().split("::").split("\\/").withoutLast().toString(".");
String toFdcBuilderClassName (String resourceName) : (resourceName.stripFilenamePostfix().split("::").split("/").last()) + "FdcBuilder";
String toQualifiedClassName (String name) : (name.split("::").split("/").toString("."));
String toQualifiedFdcBuilderClassName (String resourceName) : (resourceName.stripFilenamePostfix().split("::").split("/").toString(".")) + "FdcBuilder";
String toFdcBuilderPackage (String resourceName) : resourceName.stripFilenamePostfix().split("::").split("/").withoutLast().toString(".");
String toFdcBuilderFileName (String resourceName) : resourceName.stripFilenamePostfix().replaceAll("::", "/");
String toBuilderOpName (NamedFunctionModel f) :
"build" +
(
f.getFunctionParameterTypes().isEmpty ?
f.name.simpleName.toFirstUpper()
:
f.name.simpleName.toFirstUpper() +
"With" +
f.getFunctionParameterTypes().metaType.name.split("::").last().toFirstUpper()
);
String stripFilenamePostfix (String filename) : filename.split("\\.").size > 1 ? filename.split("\\.").withoutLast().toString(".") : filename;
String toFdcProviderClassFileName(String middleEndName, String middleEndNamespace) :
middleEndNamespace != null ?
middleEndNamespace.replaceAll("\\.", "/") + "/" + middleEndName
:
middleEndName;
String getQualifiedNameBuilder(QualifiedName n) :
n.nameSpace != null ?
"new QualifiedName(\""+ n.nameSpace +"\", \"" + n.simpleName +"\")"
:
"new QualifiedName(null, \"" + n.simpleName +"\")";
String getQualifiedNameBuilder(QualifiedName n, List[NamedParsedResource] res) :
n.nameSpace != null ?
((getFunctionNamespace(n, res) == null ?
"new QualifiedName(\"" + n.getFunctionNamespace(res) +"\", \"" + n.simpleName +"\")"
:
"new QualifiedName(null, \"" + n.simpleName +"\")"))
:
(/*(getFunctionNamespace(n, res) != null ?
"new QualifiedName(\"" + n.getFunctionNamespace(res) +"\", \"" + n.simpleName +"\")"
:*/
"new QualifiedName(null, \"" + n.simpleName +"\")")/*)*/;
String toParameterName (String paramName) : javaKeywords().contains (paramName) ? paramName + "_" : paramName;
String getVarName (Object expr, String defaultBaseName, String postfix) : defaultBaseName + postfix;
String getVarName (ExpressionBase expr, String defaultBaseName, String postfix) : defaultBaseName + postfix;
String getVarName (LocalVarEvalExpression expr, String defaultBaseName, String postfix) : expr.localVarName + postfix;
String getVarName (AroundAdvice adv, String defaultBaseName, String postfix) : defaultBaseName + postfix;
cached List javaKeywords () : {"this","class","public","protected","private","abstract","void","boolean", "int", "short", "byte", "long", "double", "float", "transient", "interface", "extends", "implements", "static", "final", "transient", "volatile", "enum", "abstract"};