[
https://issues.jboss.org/browse/ROASTER-4?page=com.atlassian.jira.plugin....
]
Kai Müller edited comment on ROASTER-4 at 1/23/19 4:10 PM:
-----------------------------------------------------------
Sure.
I did some testing and it seems that addTypeVariable is the right method to use this. The
following should be implemented
* addTypeVariable (Class)
* addTypeVariable().setName(Class)
What do you think? The name is no the best, but it should be okay. Else I could add some
default methods which act as an alias.
was (Author: kaijmueller):
Sure.
I did some testing and it seems that addTypeVariable is the right method to use this. The
following should be implemented
* addTypeVariable (Class)
* addTypeVariable().setName(Class)
What do you think? The name is no the best, but it should be okay. Else I could add some
default methods which act as an alias.
I discovered a feature gap, that wildcards (?) are not supported. To enable this, we need
to use
https://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%....
If you think that's feasible, I'll implement this in the next time.
Having Parameterize interface bit more typed
--------------------------------------------
Key: ROASTER-4
URL:
https://issues.jboss.org/browse/ROASTER-4
Project: Roaster
Issue Type: Feature Request
Components: API
Affects Versions: 2.1.0.Final
Reporter: Antonio Goncalves
Priority: Major
Fix For: 2.x Future
For a constraint, I need to implement a parametrize interface like this :
{code}
public class MaxValidatorForString implements ConstraintValidator<Max, Number> {
{code}
The only way I could find is by passing a String :
{code}
final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
javaClass.setName("MaxValidatorForString");
javaClass.addImport(ConstraintValidator.class);
javaClass.addInterface("ConstraintValidator<Max, Number>");
{code}
It's a shame because with {{addInterface(Class)}}, it does the import automatically
and things are more typed. But I cannot add types :
{code}
final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
javaClass.setName("MaxValidatorForString");
javaClass.addInterface(ConstraintValidator.class);
{code}
It would be good to have something like :
{code}
javaClass.addInterface(ConstraintValidator.class).addType(Max.class).addType(Number.class);
{code}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)