This class models a declaration, and since a declaration can be always used as a reference, it inherits {@link JClass}.
You'd want to generate fields and methods on a class. See {@link #method(int,JType,String)} and {@link #field(int,JType,String)}.
3738394041424344454647484950
generator.setOverwrite(true); generator.generate(); JCodeModel model = generator.getCodeModel(); JDefinedClass echo = model._getClass("jsr181.echo.wrapped.EchoPortType"); assertNotNull(echo); JMethod method = echo.getMethod("echo", new JType[] { model.ref(String.class) }); assertNotNull(method); assertEquals( model.ref(String.class), method.type() ); assertNotNull(model._getClass("jsr181.echo.wrapped.EchoClient")); assertNotNull(model._getClass("jsr181.echo.wrapped.EchoImpl"));
60616263646566676869
generator.setOverwrite(true); generator.generate(); JCodeModel model = generator.getCodeModel(); JDefinedClass echo = model._getClass("jsr181.globalweather.twopts.GlobalWeatherSoap"); assertNotNull(echo); echo = model._getClass("jsr181.globalweather.twopts.GlobalWeatherSoap2"); assertNotNull(echo); }
78798081828384858687
generator.setOverwrite(true); generator.generate(); JCodeModel model = generator.getCodeModel(); JDefinedClass echo = model._getClass("jsr181.globalweather.withhttp.GlobalWeatherSoap"); assertNotNull(echo); echo = model._getClass("jsr181.globalweather.withhttp.GlobalWeatherHttpGet"); assertNull(echo); }
16171819202122232425
generator.setOutputDirectory(getTestFilePath("target/test-services")); generator.setOverwrite(true); generator.generate(); JCodeModel model = generator.getCodeModel(); JDefinedClass echo = model._getClass("xfire.echo.fault.OtherEchoException"); assertNotNull(echo); echo = model._getClass("xfire.echo.fault.EchoException"); assertNotNull(echo); }
33343536373839404142
generator.setBinding("jaxb"); generator.setOverwrite(true); generator.generate(); JCodeModel model = generator.getCodeModel(); JDefinedClass echo = model._getClass("jsr181.jaxb.wwcars.wwcarsXMLInterfaceSoap"); assertNotNull(echo); assertEquals(getTestFile("src/wsdl/wwcarsXMLInterface.wsdl").toURI().toString(), generator.getBaseURI()); }
5051525354555657
generator.setBinding("jaxb"); generator.setOverwrite(true); generator.generate(); JCodeModel model = generator.getCodeModel(); JDefinedClass echo = model._getClass("jsr181.jaxb.globalweather.twopts.GlobalWeatherSoap"); assertNotNull(echo); }
6667686970717273
generator.setOverwrite(true); generator.generate(); JCodeModel model = generator.getCodeModel(); JDefinedClass echo = model._getClass("jsr181.jaxb.auth.AuthServicePortType"); assertNotNull(echo); }
8283848586878889
generator.setOverwrite(true); generator.generate(); JCodeModel model = generator.getCodeModel(); JDefinedClass echo = model._getClass("jsr181.jaxb.globalweather.GlobalWeatherSoap"); assertNotNull(echo); }
979899100101102103104105106107
generator.setOverwrite(true); generator.generate(); JCodeModel model = generator.getCodeModel(); JDefinedClass echo = model._getClass("jsr181.jaxb.echo.wrapped.EchoPortType"); assertNotNull(echo); /*JMethod method = echo.getMethod("echo", new JType[] { model._ref(String.class) }); assertNotNull(method); assertEquals( model.ref(String.class), method.type() );
119120121122123124125126
generator.setOverwrite(true); generator.generate(); JCodeModel model = generator.getCodeModel(); JDefinedClass echo = model._getClass("echo.wrapped.EchoPortType"); assertNotNull(echo); }