-
1. Re: Roaster Complex TypeVariable support
gastaldi Feb 24, 2017 7:45 AM (in response to sbordes)I believe that should be doable. Have you tried using
setSuperType("Action in
Forge - View the full discussion
<https://developer.jboss.org/message/969154?et=watches.email.thread#969154>
-
2. Re: Roaster Complex TypeVariable support
sbordes Feb 24, 2017 9:01 AM (in response to gastaldi)There isn't any super type.
I have An INterface Action implemented by an Abstracr class AbstractAction specialized by several concrete classes.
To respect fluent api AbstractAction method shall return the Concrete class type passed as TypeVariable.
public interface Action<A extends Action<A>> {
}
public abstract class AbstractAction<A extends Action<A>> implements Action<A>{
private String name;
public String name() {
return this.name;
}
public A name(final String name) {
this.name = name;
return (A) this;
}
}
public class MyAction extends AbstractAction<MyAction> {
private Object value;
public Object value() {
return this.value;
}
public MyAction setValue(final Object value) {
this.value = value;
return this;
}
With this sample I can just replace 'A extends Action<A>' by 'A' everywhere but I lose some compile type checking and for more complex samples it will be required (to generate intermediate AbstractClass with right typeVariable.
Just accepting a complete String to addTypeVariable will be sufficient to hack this trouble
Thanks
Seb
-
3. Re: Roaster Complex TypeVariable support
gastaldi Feb 26, 2017 7:42 PM (in response to sbordes)Can you open a ticket in our ROASTER - JBoss Issue Tracker with steps to reproduce (a test case would be great).
Thanks!