Date: Thu, 31 Aug 2017 13:42:53 +0200
Subject: [PATCH 27/28] Change documentation for Template
---
src/main/java/spoon/template/Template.java | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/src/main/java/spoon/template/Template.java b/src/main/java/spoon/template/Template.java
index ea3f0363fa9..d4e417d91d7 100644
--- a/src/main/java/spoon/template/Template.java
+++ b/src/main/java/spoon/template/Template.java
@@ -26,9 +26,10 @@
* {@link TemplateParameter#S()} method.
*
*
- * When the template parameter is a String or a primitive type (or a boxing
+ * When the template parameter is a String it is used to rename element of the code such as fields or methods.
+ * When it is another primitive type (or a boxing
* type) representing a literal, or a Class, the template parameter can be
- * directly accessed.
+ * directly accessed. To use a standard parameter containing a String type, use a CtLiteral<String>
*
*
* import spoon.template.Template;
@@ -38,15 +39,19 @@
* // template parameter fields
* \@Parameter String _parameter_;
*
+ * \@Parameter CtLiteral<String> _anotherParameter;
+ *
+ *
* // parameters binding
* \@Local
- * public SimpleTemplate(String parameter) {
+ * public SimpleTemplate(String parameter, CtLiteral<String> anotherParameter) {
* _parameter_ = parameter;
+ * _anotherParameter = anotherParameter;
* }
*
* // template method
- * public void simpleTemplateMethod() {
- * System.out.println(_parameter_);
+ * public void methodwith_parameter_() {
+ * System.out.println(_anotherParameter);
* }
* }
*
@@ -60,7 +65,10 @@
*
*
* spoon.reflect.CtClass target=...;
- * Template template=new SimpleTemplate("hello templated world");
+ * CtLiteral<String> anotherParameter = factory.createLiteral();
+ * anotherParameter.setValue("hello templated world");
+ *
+ * Template template=new SimpleTemplate("ParameterizedName", anotherParameter);
* Substitution.insertAll(target,template);
*
*
@@ -70,7 +78,7 @@
*
*
* public class A {
- * public void insertedMethod() {
+ * public void methodwithpPrameterizedName() {
* System.out.println("hello templated world");
* }
* }
From 5b39127be420d11f5aa8f5bb7f9a9fc3289ff99b Mon Sep 17 00:00:00 2001
From: Simon Urli
Date: Thu, 31 Aug 2017 14:15:57 +0200
Subject: [PATCH 28/28] Fix typo
---
src/main/java/spoon/template/Template.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/spoon/template/Template.java b/src/main/java/spoon/template/Template.java
index d4e417d91d7..14aecdbe6c3 100644
--- a/src/main/java/spoon/template/Template.java
+++ b/src/main/java/spoon/template/Template.java
@@ -78,7 +78,7 @@
*
*
* public class A {
- * public void methodwithpPrameterizedName() {
+ * public void methodwithParameterizedName() {
* System.out.println("hello templated world");
* }
* }