From 0f97e120cd689f0a6b5a6b4339bbcb4bc473f254 Mon Sep 17 00:00:00 2001
From: Pavel Vojtechovsky
Date: Sat, 14 Oct 2017 23:17:08 +0200
Subject: [PATCH] simplify template
---
.../java/spoon/generating/RoleHandlersGenerator.java | 2 +-
.../spoon/generating/meta/RoleHandlerTemplate.java | 10 ++++------
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/main/java/spoon/generating/RoleHandlersGenerator.java b/src/main/java/spoon/generating/RoleHandlersGenerator.java
index b1a0a1b3f7f..70adc9bd734 100644
--- a/src/main/java/spoon/generating/RoleHandlersGenerator.java
+++ b/src/main/java/spoon/generating/RoleHandlersGenerator.java
@@ -233,7 +233,7 @@ public void process() {
}
params.put("$Role$", getFactory().Type().createReference(CtRole.class));
params.put("ROLE", rim.role.name());
- params.put("targetType", rim.iface.getReference());
+ params.put("$TargetType$", rim.iface.getReference());
// params.put("AbstractHandler", getFactory().Type().createReference("spoon.reflect.meta.impl.AbstractRoleHandler"));
params.put("AbstractHandler", rim.getRoleHandlerSuperTypeQName());
params.put("Node", rim.iface.getReference());
diff --git a/src/main/java/spoon/generating/meta/RoleHandlerTemplate.java b/src/main/java/spoon/generating/meta/RoleHandlerTemplate.java
index 05aaaace908..be4814bc391 100644
--- a/src/main/java/spoon/generating/meta/RoleHandlerTemplate.java
+++ b/src/main/java/spoon/generating/meta/RoleHandlerTemplate.java
@@ -1,13 +1,12 @@
package spoon.generating.meta;
import spoon.reflect.declaration.CtElement;
-import spoon.reflect.path.CtRole;
import spoon.template.Local;
class RoleHandlerTemplate extends AbstractHandler {
private RoleHandlerTemplate() {
- super($Role$.ROLE, targetType(), ValueType.class);
+ super($Role$.ROLE, $TargetType$.class, ValueType.class);
}
@Override
@@ -20,10 +19,6 @@ public void setValue(CtElement element, Object value) {
castTarget(element).$setterName$(castValue(value));
}
- @Local
- static CtRole roleType() {
- return null;
- };
@Local
static Class extends CtElement> targetType() {
return null;
@@ -34,6 +29,9 @@ enum $Role$ {
ROLE
}
+class $TargetType$ {
+}
+
class Node {
ValueType $getterName$() {
return null;