Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Struckmann2014-10-22 12:17:44 +0000
committerSebastian Struckmann2014-10-22 12:18:05 +0000
commit352b6cdf7c203aced033c8b6dee2becc5495b03d (patch)
treedf9e506aea6bf6a256851216acc27b1b5d7747e0 /org.eclipse.jubula.toolkit.api.gen
parent30ef52e45739d2b94b168c5d01ffabe459f02fef (diff)
downloadorg.eclipse.jubula.core-352b6cdf7c203aced033c8b6dee2becc5495b03d.tar.gz
org.eclipse.jubula.core-352b6cdf7c203aced033c8b6dee2becc5495b03d.tar.xz
org.eclipse.jubula.core-352b6cdf7c203aced033c8b6dee2becc5495b03d.zip
Sprint task - Java API - Added NonNull-annotations to generated classes
Diffstat (limited to 'org.eclipse.jubula.toolkit.api.gen')
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/templates/ClassGenerator.javajet19
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/templates/FactoryGenerator.javajet19
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/templates/ToolkitInfoGenerator.javajet17
3 files changed, 30 insertions, 25 deletions
diff --git a/org.eclipse.jubula.toolkit.api.gen/templates/ClassGenerator.javajet b/org.eclipse.jubula.toolkit.api.gen/templates/ClassGenerator.javajet
index c2d65d37d..d5116c463 100644
--- a/org.eclipse.jubula.toolkit.api.gen/templates/ClassGenerator.javajet
+++ b/org.eclipse.jubula.toolkit.api.gen/templates/ClassGenerator.javajet
@@ -74,6 +74,7 @@ if (specInfo instanceof ComponentGenInfo) {
*******************************************************************************/
package <%=packageName%>;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jubula.communication.CAP;
<%if (!genInterface) {%>
import org.apache.commons.lang.Validate;
@@ -107,7 +108,7 @@ public <%if (genInterface) {%>interface<%} else {%>class<%}%> <%=className%>
public <%=className%>() {
super();
}<%} else {%>
- public <%=className%>(ComponentIdentifier componentIdentifier) {
+ public <%=className%>(@NonNull ComponentIdentifier componentIdentifier) {
super(componentIdentifier);
}<%}%>
<%} else {%>
@@ -116,7 +117,7 @@ public <%if (genInterface) {%>interface<%} else {%>class<%}%> <%=className%>
super();
}<%} else {%>
protected IComponentIdentifier m_componentIdentifier;
- public <%=className%>(ComponentIdentifier componentIdentifier) {
+ public <%=className%>(@NonNull ComponentIdentifier componentIdentifier) {
super();
Validate.isTrue(componentIdentifier instanceof IComponentIdentifier);
m_componentIdentifier = (IComponentIdentifier) componentIdentifier;
@@ -129,7 +130,7 @@ public <%if (genInterface) {%>interface<%} else {%>class<%}%> <%=className%>
<%if (hasComponentClass) {%>
org.eclipse.jubula.tools.internal.objects.ComponentIdentifier pseudoIdentifier =
new org.eclipse.jubula.tools.internal.objects.ComponentIdentifier();
- pseudoIdentifier.setComponentClassName("<%=componentClassName%>");
+ pseudoIdentifier.setComponentClassName("<%=componentClassName%>"); //$NON-NLS-1$
return pseudoIdentifier;
<%} else {%>
return null;
@@ -152,7 +153,7 @@ public <%if (genInterface) {%>interface<%} else {%>class<%}%> <%=className%>
List<Param> params = action.getParams();
%>
<%if (action.isDeprecated()) {%>@Deprecated<%}%>
- public CAP <%=methodName%>(
+ @NonNull public CAP <%=methodName%>(
<%
// add parameters to method
Map<String, String> paramMap = new HashMap<String, String>();
@@ -165,11 +166,11 @@ public <%if (genInterface) {%>interface<%} else {%>class<%}%> <%=className%>
String paramName = nameLoader.translateFromCompSystem(name);
paramMap.put(name, paramType);
%>
- <%=paramType%> <%=paramName%><%if(paramIterator.hasNext()){%>,<%}%>
+ @NonNull <%=paramType%> <%=paramName%><%if(paramIterator.hasNext()){%>,<%}%>
<%}%>
) <%if (genInterface) {%>;<%} else {%>{
MessageCap messageCap = new MessageCap();
- messageCap.setMethod("<%=action.getMethod()%>");
+ messageCap.setMethod("<%=action.getMethod()%>"); //$NON-NLS-1$
messageCap.sethasDefaultMapping(<%=hasDefaultMapping%>);
<%if (!hasDefaultMapping) {%>
messageCap.setCi(m_componentIdentifier);
@@ -178,12 +179,12 @@ public <%if (genInterface) {%>interface<%} else {%>class<%}%> <%=className%>
<%for (Param parameter : params) {
String paramName = parameter.getName();%>
<%String translatedParamName = nameLoader.translateFromCompSystem(paramName);%>
- Validate.notNull(<%=translatedParamName%>, "Argument '<%=translatedParamName%>' must not be null");
+ Validate.notNull(<%=translatedParamName%>, "Argument '<%=translatedParamName%>' must not be null"); //$NON-NLS-1$
<%String paramType = paramMap.get(paramName);%>
<%if (nameLoader.isInEnumMap(paramType)) {%>
- messageCap.addMessageParam(new MessageParam(<%=translatedParamName%>.rcValue(), "java.lang.String"));
+ messageCap.addMessageParam(new MessageParam(<%=translatedParamName%>.rcValue(), "java.lang.String")); //$NON-NLS-1$
<%} else {%>
- messageCap.addMessageParam(new MessageParam(<%=translatedParamName%>.toString(), "<%=paramType%>"));
+ messageCap.addMessageParam(new MessageParam(<%=translatedParamName%>.toString(), "<%=paramType%>")); //$NON-NLS-1$
<%}%>
<%}%>
return messageCap;
diff --git a/org.eclipse.jubula.toolkit.api.gen/templates/FactoryGenerator.javajet b/org.eclipse.jubula.toolkit.api.gen/templates/FactoryGenerator.javajet
index 4104db5bd..6738cdcdd 100644
--- a/org.eclipse.jubula.toolkit.api.gen/templates/FactoryGenerator.javajet
+++ b/org.eclipse.jubula.toolkit.api.gen/templates/FactoryGenerator.javajet
@@ -28,6 +28,8 @@ if (specInfo instanceof FactoryGenInfo) {
*******************************************************************************/
package <%=packageName%>;
+import org.apache.commons.lang.Validate;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jubula.tools.ComponentIdentifier;
import org.eclipse.jubula.toolkit.ToolkitInfo;
@@ -38,18 +40,18 @@ import org.eclipse.jubula.toolkit.ToolkitInfo;
* This class is not intended to be sub-classed.
*/
public final class <%=factoryName%> {
-
- private static ToolkitInfo m_toolkitInformation =
- <%if (toolkitInfoName != null) {%>new <%=toolkitInfoName%>();
- <%} else {%>null;<%}%>
+
+ <%if (toolkitInfoName != null) {%>
+ @NonNull private final static ToolkitInfo m_toolkitInformation = new <%=toolkitInfoName%>();<%}%>
private <%=factoryName%>() {
super();
}
- public static ToolkitInfo getToolkitInformation() {
+ <%if (toolkitInfoName != null) {%>
+ @NonNull public static ToolkitInfo getToolkitInformation() {
return m_toolkitInformation;
- }
+ }<%}%>
<%for (CompInfoForFactoryGen compInfo : compInfoList) {
String componentName = compInfo.getComponentName();
@@ -57,10 +59,11 @@ public final class <%=factoryName%> {
String returnType = compInfo.getMostSpecificVisibleSuperTypeName();
Boolean hasDefaultMapping = compInfo.hasDefaultMapping();%>
<%if (hasDefaultMapping) {%>
- public static <%=returnType%> create<%=componentName%> () {
+ @NonNull public static <%=returnType%> create<%=componentName%> () {
return new <%=implClassName%>();
}<%} else {%>
- public static <%=returnType%> create<%=componentName%> (ComponentIdentifier componentIdentifier) {
+ @NonNull public static <%=returnType%> create<%=componentName%> (@NonNull ComponentIdentifier componentIdentifier) {
+ Validate.notNull(componentIdentifier);
return new <%=implClassName%>(componentIdentifier);
}<%}%>
<%}%>
diff --git a/org.eclipse.jubula.toolkit.api.gen/templates/ToolkitInfoGenerator.javajet b/org.eclipse.jubula.toolkit.api.gen/templates/ToolkitInfoGenerator.javajet
index 5a611ca5b..e642815a1 100644
--- a/org.eclipse.jubula.toolkit.api.gen/templates/ToolkitInfoGenerator.javajet
+++ b/org.eclipse.jubula.toolkit.api.gen/templates/ToolkitInfoGenerator.javajet
@@ -33,6 +33,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jubula.toolkit.internal.AbstractToolkitInfo;
import org.eclipse.jubula.tools.internal.xml.businessmodell.ComponentClass;
import org.eclipse.jubula.tools.internal.xml.businessmodell.Property;
@@ -42,7 +43,7 @@ import org.eclipse.jubula.tools.internal.xml.businessmodell.Property;
*/
public final class <%=className%> extends AbstractToolkitInfo {
- private Map<ComponentClass, String> m_map = new HashMap<ComponentClass, String>();
+ @NonNull private Map<ComponentClass, String> m_map = new HashMap<ComponentClass, String>();
/**
* Constructor
@@ -53,7 +54,7 @@ public final class <%=className%> extends AbstractToolkitInfo {
ComponentClass componentClass = compInfo.getComponentClass();
String testerClass = compInfo.getTesterClass();
if (componentClass != null && testerClass != null) {%>
- ComponentClass newComponentClass<%=i%> = new ComponentClass("<%=componentClass.getName()%>");
+ ComponentClass newComponentClass<%=i%> = new ComponentClass("<%=componentClass.getName()%>"); //$NON-NLS-1$
<%List properties = componentClass.getProperties();%>
<%if (!properties.isEmpty()) {%>
List<Property> newProperties<%=i%> = new ArrayList<Property>();
@@ -62,28 +63,28 @@ public final class <%=className%> extends AbstractToolkitInfo {
<%if (obj instanceof Property) {
Property property = (Property) obj;%>
Property newProperty<%=i%>_<%=j%> = new Property();
- newProperty<%=i%>_<%=j%>.setName("<%=property.getName()%>");
- newProperty<%=i%>_<%=j%>.setValue("<%=property.getValue()%>");
+ newProperty<%=i%>_<%=j%>.setName("<%=property.getName()%>"); //$NON-NLS-1$
+ newProperty<%=i%>_<%=j%>.setValue("<%=property.getValue()%>"); //$NON-NLS-1$
newProperties<%=i%>.add(newProperty<%=i%>_<%=j%>);
<%}%>
<%j++;%>
<%}%>
newComponentClass<%=i%>.setProperties(newProperties<%=i%>);
<%}%>
- m_map.put(newComponentClass<%=i%>,"<%=testerClass%>");
+ m_map.put(newComponentClass<%=i%>,"<%=testerClass%>"); //$NON-NLS-1$
<%}%>
<%i++;%>
<%}%>
}
/** {@inheritDoc} */
- public Map<ComponentClass, String> getTypeMapping() {
+ @NonNull public Map<ComponentClass, String> getTypeMapping() {
return m_map;
}
/** {@inheritDoc} */
- public String getToolkitID() {
- return "<%=genInfo.getToolkitID()%>";
+ @NonNull public String getToolkitID() {
+ return "<%=genInfo.getToolkitID()%>"; //$NON-NLS-1$
}
}
<%}%> \ No newline at end of file

Back to the top