[forge-issues] [JBoss JIRA] (ROASTER-63) JavaClassSource - Cannot extend another class when using the fluent builder

Nicolas Challut (JIRA) issues at jboss.org
Tue Feb 17 07:50:49 EST 2015


    [ https://issues.jboss.org/browse/ROASTER-63?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13040833#comment-13040833 ] 

Nicolas Challut commented on ROASTER-63:
----------------------------------------

Okay, the doc isn't perfect but I think that you could find this one ;)

{code}
        JavaClassSource source = Roaster.create(JavaClassSource.class);
        source.setName("Bar");
        source.setSuperType("org.apache.camel.builder.RouteBuilder");
{code}

> JavaClassSource - Cannot extend another class when using the fluent builder
> ---------------------------------------------------------------------------
>
>                 Key: ROASTER-63
>                 URL: https://issues.jboss.org/browse/ROASTER-63
>             Project: Roaster
>          Issue Type: Enhancement
>            Reporter: Claus Ibsen
>
> I need to create a java class that extends another. As there is no .addExtends or .extends or something I had to work around and use the parse.
> I can only find an .addInterface
> Here is the code I use with my workaround
> {code}
>         // need to parse to be able to extends another class
>         String top = String.format("public class %s extends RouteBuilder {}", name.getValue());
>         final JavaClassSource javaClass = Roaster.parse(JavaClassSource.class, top);
>         if (targetPackage.getValue() != null) {
>             javaClass.setPackage(targetPackage.getValue());
>         }
> {code}
> eg what I want to do is
> {code}
> javaClass.extends("RouteBuilder");
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.11#6341)


More information about the forge-issues mailing list