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

George Gastaldi (JIRA) issues at jboss.org
Mon Sep 28 17:47:00 EDT 2015


     [ https://issues.jboss.org/browse/ROASTER-63?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

George Gastaldi closed ROASTER-63.
----------------------------------
    Fix Version/s: 2.16.0.Final
                       (was: 2.x Future)
         Assignee: George Gastaldi
       Resolution: Done


Even though having setSuperType, ROASTER-51 introduces {{implementInterface(...)}} and {{extendSupertype(...)}} to automatically import the required methods

> 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
>            Assignee: George Gastaldi
>             Fix For: 2.16.0.Final
>
>
> 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.4.11#64026)


More information about the forge-issues mailing list