Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Struckmann2014-09-09 08:13:41 +0000
committerSebastian Struckmann2014-09-09 08:14:26 +0000
commited930ffe2e7ca10127f72ba45bdc10d2a0596c94 (patch)
tree4c4083d00b036f85bed585b02d038d58ba53d817 /org.eclipse.jubula.toolkit.api.gen/templates/componentGenerator.javajet
parenta8773713b850fcbc00b6b45fcea44fb37cdbe974 (diff)
downloadorg.eclipse.jubula.core-ed930ffe2e7ca10127f72ba45bdc10d2a0596c94.tar.gz
org.eclipse.jubula.core-ed930ffe2e7ca10127f72ba45bdc10d2a0596c94.tar.xz
org.eclipse.jubula.core-ed930ffe2e7ca10127f72ba45bdc10d2a0596c94.zip
Sprint task - Add infrastructure for API generation invokation
Diffstat (limited to 'org.eclipse.jubula.toolkit.api.gen/templates/componentGenerator.javajet')
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/templates/componentGenerator.javajet71
1 files changed, 71 insertions, 0 deletions
diff --git a/org.eclipse.jubula.toolkit.api.gen/templates/componentGenerator.javajet b/org.eclipse.jubula.toolkit.api.gen/templates/componentGenerator.javajet
new file mode 100644
index 000000000..49addf3a9
--- /dev/null
+++ b/org.eclipse.jubula.toolkit.api.gen/templates/componentGenerator.javajet
@@ -0,0 +1,71 @@
+<%@ jet
+package="org.eclipse.jubula.toolkit.api.gen"
+imports="java.util.*
+ org.eclipse.jubula.toolkit.api.gen.internal.ClassGenerator
+ org.eclipse.jubula.toolkit.api.gen.internal.NameMappingLoader
+ org.eclipse.jubula.tools.xml.businessmodell.*"
+class="ComponentGenerator"%>
+<%
+ Component component = (Component)argument;
+ NameMappingLoader nameLoader = NameMappingLoader.getInstance();
+ List<Action> actions = component.getActions();
+ String[] splitName = ClassGenerator.splitName(component.getType());
+ String path = nameLoader.getDesiredName(splitName[0]);
+ String name = nameLoader.getDesiredName(splitName[1]);
+ List<String> realizedTypes = component.getRealizedTypes();
+ String realizedType = realizedTypes.size() > 0 ? realizedTypes.get(0) : null;
+ String testerClass = "";
+ if (component instanceof ConcreteComponent) {
+ testerClass = ((ConcreteComponent)component).getTesterClass();
+ }
+ %>
+/*******************************************************************************
+ * Copyright (c) 2014 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package <%="org.eclipse.jubula.toolkit.base.internal." + path%>;
+
+import org.eclipse.jubula.toolkit.base.api.internal.annotations.RealizedType;
+import org.eclipse.jubula.toolkit.base.api.internal.annotations.TesterClass;
+
+@RealizedType(realizedType="<%=realizedType%>")
+@TesterClass(testerClass="<%=testerClass%>")
+public class <%=name%> {
+ Object m_component;
+
+ public <%=name%>(Object component) {
+ m_component = component;
+ }
+ <%
+ Iterator<Action> actionsIterator = actions.iterator();
+ while (actionsIterator.hasNext()) {
+ Action action = actionsIterator.next();
+ String actionName = nameLoader.getDesiredName(action.getMethod());
+ List<Param> params = action.getParams();
+ %>
+ <%if (action.isDeprecated()) {%>@Deprecated<%}%>
+ public void <%=actionName%>(
+ <%
+ Iterator<Param> paramIterator = params.iterator();
+ while (paramIterator.hasNext()) {
+ Param param = paramIterator.next();
+ String paramType = nameLoader.getDesiredName(param.getType());
+ String paramName = nameLoader.getDesiredName(param.getName().replace(".",""));
+ %>
+ <%=paramType%> <%=paramName%><%if(paramIterator.hasNext()){%>,<%}%>
+ <%
+ }
+ %>
+ ) {
+
+ }
+ <%
+ }
+ %>
+} \ No newline at end of file

Back to the top