Skip to content

Commit

Permalink
simplify template
Browse files Browse the repository at this point in the history
  • Loading branch information
pvojtechovsky committed Oct 14, 2017
1 parent efa42f4 commit 0f97e12
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/java/spoon/generating/RoleHandlersGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
10 changes: 4 additions & 6 deletions src/main/java/spoon/generating/meta/RoleHandlerTemplate.java
Original file line number Diff line number Diff line change
@@ -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<Node, ValueType> {

private RoleHandlerTemplate() {
super($Role$.ROLE, targetType(), ValueType.class);
super($Role$.ROLE, $TargetType$.class, ValueType.class);
}

@Override
Expand All @@ -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;
Expand All @@ -34,6 +29,9 @@ enum $Role$ {
ROLE
}

class $TargetType$ {
}

class Node {
ValueType $getterName$() {
return null;
Expand Down

0 comments on commit 0f97e12

Please sign in to comment.