use of org.apache.cxf.tools.common.model.JavaClass in project cxf by apache.
the class WrapperTest method testGetWrapperBeanClassFromMethod.
@Test
public void testGetWrapperBeanClassFromMethod() throws Exception {
String pkgName = "org.apache.cxf.tools.fortest.classnoanno.docwrapped";
Class<?> stockClass = Class.forName(pkgName + ".Stock");
Method method = stockClass.getMethod("getPrice", String.class);
Wrapper wrapper = new Wrapper();
wrapper.setMethod(method);
JavaClass jClass = wrapper.getWrapperBeanClass(method);
assertNotNull(jClass);
assertNull(jClass.getPackageName());
assertNull(jClass.getName());
wrapper = new RequestWrapper();
jClass = wrapper.getWrapperBeanClass(method);
assertEquals("GetPrice", jClass.getName());
assertEquals(pkgName + ".jaxws", jClass.getPackageName());
wrapper = new ResponseWrapper();
jClass = wrapper.getWrapperBeanClass(method);
assertEquals("GetPriceResponse", jClass.getName());
assertEquals(pkgName + ".jaxws", jClass.getPackageName());
}
use of org.apache.cxf.tools.common.model.JavaClass in project cxf by apache.
the class FaultBeanGenerator method generateBeanClasses.
protected Collection<JavaClass> generateBeanClasses(final ServiceInfo serviceInfo) {
Set<Class<?>> exceptionClasses = new HashSet<>();
String seiPackageName = null;
for (OperationInfo op : serviceInfo.getInterface().getOperations()) {
Method method = (Method) op.getProperty("operation.method");
exceptionClasses.addAll(getExceptionClasses(method));
seiPackageName = getSEIPackage(method);
}
Collection<JavaClass> faultBeanClasses = new HashSet<>();
String defaultPackage = seiPackageName + ".jaxws";
FaultBean bean = new FaultBean();
for (Class<?> clz : exceptionClasses) {
if (!bean.faultBeanExists(clz)) {
faultBeanClasses.add(bean.transform(clz, defaultPackage));
}
}
return faultBeanClasses;
}
use of org.apache.cxf.tools.common.model.JavaClass in project cxf by apache.
the class WrapperBeanGenerator method generateBeanClasses.
protected Collection<JavaClass> generateBeanClasses(final ServiceInfo serviceInfo) {
Collection<JavaClass> wrapperClasses = new HashSet<>();
for (OperationInfo op : serviceInfo.getInterface().getOperations()) {
if (op.getUnwrappedOperation() != null) {
if (op.hasInput()) {
RequestWrapper requestWrapper = new RequestWrapper();
requestWrapper.setOperationInfo(op);
JavaClass jClass = requestWrapper.buildWrapperBeanClass();
if (requestWrapper.isWrapperBeanClassNotExist()) {
wrapperClasses.add(jClass);
}
}
if (op.hasOutput()) {
ResponseWrapper responseWrapper = new ResponseWrapper();
responseWrapper.setOperationInfo(op);
JavaClass jClass = responseWrapper.buildWrapperBeanClass();
if (responseWrapper.isWrapperBeanClassNotExist()) {
wrapperClasses.add(jClass);
}
}
}
}
return wrapperClasses;
}
Aggregations