01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */package org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.mapper;
19:
20: import org.apache.cxf.jaxb.JAXBUtils;
21: import org.apache.cxf.service.model.MessagePartInfo;
22: import org.apache.cxf.tools.common.ToolContext;
23: import org.apache.cxf.tools.common.model.JavaParameter;
24: import org.apache.cxf.tools.common.model.JavaType;
25: import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.ProcessorUtil;
26:
27: public final class ParameterMapper {
28:
29: private ParameterMapper() {
30: }
31:
32: public static JavaParameter map(MessagePartInfo part,
33: JavaType.Style style, ToolContext context) {
34: String name = ProcessorUtil.mangleNameToVariableName(part
35: .getName().getLocalPart());
36: String namespace = ProcessorUtil.resolvePartNamespace(part);
37: String type = ProcessorUtil.resolvePartType(part, context);
38:
39: JavaParameter parameter = new JavaParameter(name, type,
40: namespace);
41: parameter.setPartName(part.getName().getLocalPart());
42: parameter.setQName(ProcessorUtil.getElementName(part));
43: parameter.setDefaultValueWriter(ProcessorUtil
44: .getDefaultValueWriter(part, context));
45: String fullJavaName = ProcessorUtil.getFullClzName(part,
46: context, false);
47:
48: parameter.setClassName(fullJavaName);
49:
50: if (style == JavaType.Style.INOUT
51: || style == JavaType.Style.OUT) {
52: parameter.setHolder(true);
53: parameter
54: .setHolderName(javax.xml.ws.Holder.class.getName());
55: String holderClass = fullJavaName;
56: if (JAXBUtils.holderClass(fullJavaName) != null) {
57: holderClass = JAXBUtils.holderClass(fullJavaName)
58: .getName();
59: }
60: parameter.setClassName(holderClass);
61: }
62: parameter.setStyle(style);
63: return parameter;
64: }
65:
66: }
|