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)}.
135136137138139140141142
generator.setGenerateServerStubs(false); generator.generate(); JCodeModel model = generator.getCodeModel(); JDefinedClass echo = model._getClass("org.codehaus.xfire.generator.noserverstubs.EchoImpl"); assertNull(echo); }
150151152153154155156157158159160
generator.setGenerateServerStubs(false); generator.generate(); JCodeModel model = generator.getCodeModel(); JDefinedClass echo = model._getClass("echo.wrapped.unbounded.EchoPortType"); assertNotNull(echo); JMethod jm = echo.methods().iterator().next(); assertEquals("java.util.List<java.lang.String>", jm.type().fullName()); }
168169170171172173174175176177178
generator.setGenerateServerStubs(false); generator.generate(); JCodeModel model = generator.getCodeModel(); JDefinedClass echo = model._getClass("echo.wrapped.keyword.EchoPortType"); assertNotNull(echo); JMethod jm = echo.methods().iterator().next(); assertEquals("java.util.List<java.lang.String>", jm.type().fullName()); }
186187188189190191192193194195196
generator.setGenerateServerStubs(false); generator.generate(); JCodeModel model = generator.getCodeModel(); JDefinedClass echo = model._getClass("echo.wrapped.mtom.EchoPortType"); assertNotNull(echo); JMethod jm = echo.methods().iterator().next(); assertEquals("javax.activation.DataHandler", jm.type().fullName()); }
15161718192021222324
generator.setOutputDirectory(getTestFilePath("target/test-services")); generator.setOverwrite(true); generator.generate(); JCodeModel model = generator.getCodeModel(); JDefinedClass c = model._getClass("org.something.services.hello.HelloFaultMessage"); assertNotNull(c); c = model._getClass("org.something.services.hello.HelloFault"); assertNotNull(c); }
3132333435363738
generator.setDestinationPackage("jsr181.jaxb.echofault"); generator.setOverwrite(true); generator.generate(); JCodeModel model = generator.getCodeModel(); JDefinedClass echo = model._getClass("jsr181.jaxb.echofault.EchoWithFaultPortType"); assertNotNull(echo); }
21222324252627282930313233
generator.setBaseURI(getTestFilePath("src/wsdl/import-test/")); generator.setOverwrite(true); generator.generate(); JCodeModel model = generator.getCodeModel(); JDefinedClass concat = model._getClass("org.codehaus.xfire.generator.messagepart.concatPortType"); assertNotNull(concat); JType string = model._ref(String.class); JMethod method = concat.getMethod("concat", new JType[] { string, string }); // if there were a way to look at the annotations we would do that here. }
2021222324252627282930
generator.setOverwrite(true); generator.generate(); JCodeModel model = generator.getCodeModel(); JDefinedClass echo = model._getClass("org.codehaus.xfire.test.echo.SendMessagePortType"); assertNotNull(echo); File file = getTestFile("target/test-services/org/codehaus/xfire/test/echo/SendMessageImpl.java"); assertTrue(file.exists()); long lastModified = file.lastModified();
1920212223242526
generator.setOverwrite(true); generator.generate(); JCodeModel model = generator.getCodeModel(); JDefinedClass soap = model._getClass("org.codehaus.xfire.generator.imports.MyServiceSoap"); assertNotNull(soap); }
3637383940414243
generator.setOverwrite(true); generator.generate(); JCodeModel model = generator.getCodeModel(); JDefinedClass echo = model._getClass("org.codehaus.xfire.generator.imports.EchoPortType"); assertNotNull(echo); }