use of org.apache.cxf.tools.common.model.JavaParameter in project cxf by apache.
the class ParameterMapper method map.
public static JavaParameter map(JavaMethod jm, MessagePartInfo part, JavaType.Style style, ToolContext context) {
String name = ProcessorUtil.mangleNameToVariableName(part.getName().getLocalPart());
String namespace = ProcessorUtil.resolvePartNamespace(part);
String type = ProcessorUtil.resolvePartType(part, context);
JavaParameter parameter = new JavaParameter(name, type, namespace);
parameter.setPartName(part.getName().getLocalPart());
if (part.getXmlSchema() instanceof XmlSchemaSimpleType) {
processXmlSchemaSimpleType((XmlSchemaSimpleType) part.getXmlSchema(), jm, parameter, part);
} else if (part.getXmlSchema() instanceof XmlSchemaElement) {
XmlSchemaElement element = (XmlSchemaElement) part.getXmlSchema();
if (element.getSchemaType() instanceof XmlSchemaSimpleType) {
processXmlSchemaSimpleType((XmlSchemaSimpleType) element.getSchemaType(), jm, parameter, part);
}
}
parameter.setQName(ProcessorUtil.getElementName(part));
parameter.setDefaultValueWriter(ProcessorUtil.getDefaultValueWriter(part, context));
String fullJavaName = ProcessorUtil.getFullClzName(part, context, false);
parameter.setClassName(fullJavaName);
if (style == JavaType.Style.INOUT || style == JavaType.Style.OUT) {
parameter.setHolder(true);
parameter.setHolderName(javax.xml.ws.Holder.class.getName());
String holderClass = fullJavaName;
if (JAXBUtils.holderClass(fullJavaName) != null) {
holderClass = JAXBUtils.holderClass(fullJavaName).getName();
}
parameter.setClassName(holderClass);
}
parameter.setStyle(style);
return parameter;
}
use of org.apache.cxf.tools.common.model.JavaParameter in project cxf by apache.
the class JavaFirstUtil method serviceInfo2JavaInf.
public static JavaInterface serviceInfo2JavaInf(ServiceInfo service) {
JavaInterface javaInf = new JavaInterface();
InterfaceInfo inf = service.getInterface();
for (OperationInfo op : inf.getOperations()) {
JavaMethod jm = new JavaMethod();
Method m = (Method) op.getProperty(ReflectionServiceFactoryBean.METHOD);
jm.setName(m.getName());
int i = 0;
for (Type type : m.getGenericParameterTypes()) {
JavaParameter jp = new JavaParameter();
jp.setClassName(getClassName(type));
jp.setStyle(Style.IN);
jp.setName("arg" + i++);
jm.addParameter(jp);
}
for (Type type : m.getGenericExceptionTypes()) {
JavaException jex = new JavaException();
String className = getClassName(type);
jex.setClassName(className);
jex.setName(className);
jm.addException(jex);
}
JavaReturn jreturn = new JavaReturn();
jreturn.setClassName(getClassName(m.getGenericReturnType()));
jreturn.setStyle(Style.OUT);
jm.setReturn(jreturn);
String pkg = PackageUtils.getPackageName(m.getDeclaringClass());
javaInf.setPackageName(pkg.length() == 0 ? ToolConstants.DEFAULT_PACKAGE_NAME : pkg);
javaInf.addMethod(jm);
javaInf.setName(inf.getName().getLocalPart());
jm.getParameterList();
}
return javaInf;
}
use of org.apache.cxf.tools.common.model.JavaParameter in project cxf by apache.
the class JAXWSFrontEndProcessor method serviceInfo2JavaInf.
public JavaInterface serviceInfo2JavaInf(ServiceInfo service) {
JavaInterface javaInf = new JavaInterface();
InterfaceInfo inf = service.getInterface();
for (OperationInfo op : inf.getOperations()) {
JavaMethod jm = new JavaMethod();
Method m = (Method) op.getProperty(ReflectionServiceFactoryBean.METHOD);
jm.setName(m.getName());
int i = 0;
for (Type type : m.getGenericParameterTypes()) {
JavaParameter jp = new JavaParameter();
jp.setClassName(getClassName(type));
jp.setStyle(Style.IN);
jp.setName("arg" + i++);
jm.addParameter(jp);
}
for (Type type : m.getGenericExceptionTypes()) {
JavaException jex = new JavaException();
String className = getClassName(type);
jex.setClassName(className);
jex.setName(className);
jm.addException(jex);
}
JavaReturn jreturn = new JavaReturn();
jreturn.setClassName(getClassName(m.getGenericReturnType()));
jreturn.setStyle(Style.OUT);
jm.setReturn(jreturn);
String pkg = PackageUtils.getPackageName(m.getDeclaringClass());
javaInf.setPackageName(pkg.length() > 0 ? pkg : ToolConstants.DEFAULT_PACKAGE_NAME);
javaInf.addMethod(jm);
javaInf.setName(inf.getName().getLocalPart());
jm.getParameterList();
}
return javaInf;
}
Aggregations