Java Code Examples for javax.xml.bind.annotation.XmlElement#name()

The following examples show how to use javax.xml.bind.annotation.XmlElement#name() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RuntimeModeler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static QName getParameterQName(Method method, WebParam webParam, XmlElement xmlElem, String paramDefault) {
    String webParamName = null;
    if (webParam != null && webParam.name().length() > 0) {
        webParamName = webParam.name();
    }
    String xmlElemName = null;
    if (xmlElem != null && !xmlElem.name().equals("##default")) {
        xmlElemName = xmlElem.name();
    }
    if (xmlElemName != null && webParamName != null && !xmlElemName.equals(webParamName)) {
        throw new RuntimeModelerException("@XmlElement(name)="+xmlElemName+" and @WebParam(name)="+webParamName+" are different for method " +method);
    }
    String localPart = paramDefault;
    if (webParamName != null) {
        localPart = webParamName;
    } else if (xmlElemName != null) {
        localPart =  xmlElemName;
    }

    String webParamNS = null;
    if (webParam != null && webParam.targetNamespace().length() > 0) {
        webParamNS = webParam.targetNamespace();
    }
    String xmlElemNS = null;
    if (xmlElem != null && !xmlElem.namespace().equals("##default")) {
        xmlElemNS = xmlElem.namespace();
    }
    if (xmlElemNS != null && webParamNS != null && !xmlElemNS.equals(webParamNS)) {
        throw new RuntimeModelerException("@XmlElement(namespace)="+xmlElemNS+" and @WebParam(targetNamespace)="+webParamNS+" are different for method " +method);
    }
    String ns = "";
    if (webParamNS != null) {
        ns = webParamNS;
    } else if (xmlElemNS != null) {
        ns =  xmlElemNS;
    }

    return new QName(ns, localPart);
}
 
Example 2
Source File: XPathUtil.java    From jpmml-model with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
static
public String formatElementOrAttribute(Class<? extends PMMLObject> elementClazz, Field field){
	XmlElement element = field.getAnnotation(XmlElement.class);
	XmlAttribute attribute = field.getAnnotation(XmlAttribute.class);

	if(element != null){
		Class<?> childElementClazz = field.getType();

		if((List.class).isAssignableFrom(childElementClazz)){
			ParameterizedType listType = (ParameterizedType)field.getGenericType();

			Type[] typeArguments = listType.getActualTypeArguments();
			if(typeArguments.length != 1){
				throw new IllegalArgumentException();
			}

			childElementClazz = (Class<?>)typeArguments[0];
		}

		try {
			return getElementName(elementClazz) + "/" + getElementName(childElementClazz);
		} catch(IllegalArgumentException iae){
			return getElementName(elementClazz) + "/" + element.name();
		}
	} else

	if(attribute != null){
		return getElementName(elementClazz) + "@" + attribute.name();
	}

	throw new IllegalArgumentException();
}
 
Example 3
Source File: TypeGen.java    From xsd-2-go with GNU General Public License v2.0 5 votes vote down vote up
public String typeOf(XmlElement element, JaxbFactory jaxbFactory) {

		String refType = element.type().getName();
		// builtin type
		boolean isBuiltin = this.typeConvertor.isPrimitive(refType);
		if (isBuiltin) {
			return this.typeConvertor.getGoType(refType);
		}

		// struct type
		String goType = this.typeConvertor.getGoType(refType);
		if (goType != null) {
			
			return "[]" + "XML" + goType;
		}

		// jaxb type
		if (refType.equals("javax.xml.bind.JAXBElement")) {
			String qname = element.name();
			Class paramClass = jaxbFactory.getJaxbElementType(qname);
			goType = this.typeConvertor.getGoType(paramClass.getName());
			if (goType == null) {
				System.err.println("can not map to Go Type: " + paramClass.getName());
			}

			if (this.typeConvertor.isPrimitive(paramClass.getName())) {
				return goType;
			}

			return "[]" + "XML" + goType;
		}

		System.err.println("can not map to Go type: " + refType);
		return null;
	}
 
Example 4
Source File: MainFindOccurrances.java    From ph-ubl with Apache License 2.0 5 votes vote down vote up
/**
 * Create an XML name from the passed field. It uses the {@link XmlElement},
 * {@link XmlAttribute} and {@link XmlValue} annotations to differentiate.
 *
 * @param aField
 *        Source field
 * @return Never <code>null</code>.
 */
@Nonnull
public static String _getXMLName (@Nonnull final Field aField)
{
  final XmlElement aElement = aField.getAnnotation (XmlElement.class);
  if (aElement != null)
    return "/" + aElement.name ();
  final XmlAttribute aAttr = aField.getAnnotation (XmlAttribute.class);
  if (aAttr != null)
    return "/@" + aAttr.name ();
  if (aField.getAnnotation (XmlValue.class) != null)
    return "/value()";
  throw new IllegalStateException ("Field is neither XML element nor attribute nor value: " + aField);
}
 
Example 5
Source File: RuntimeModeler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static QName getParameterQName(Method method, WebParam webParam, XmlElement xmlElem, String paramDefault) {
    String webParamName = null;
    if (webParam != null && webParam.name().length() > 0) {
        webParamName = webParam.name();
    }
    String xmlElemName = null;
    if (xmlElem != null && !xmlElem.name().equals("##default")) {
        xmlElemName = xmlElem.name();
    }
    if (xmlElemName != null && webParamName != null && !xmlElemName.equals(webParamName)) {
        throw new RuntimeModelerException("@XmlElement(name)="+xmlElemName+" and @WebParam(name)="+webParamName+" are different for method " +method);
    }
    String localPart = paramDefault;
    if (webParamName != null) {
        localPart = webParamName;
    } else if (xmlElemName != null) {
        localPart =  xmlElemName;
    }

    String webParamNS = null;
    if (webParam != null && webParam.targetNamespace().length() > 0) {
        webParamNS = webParam.targetNamespace();
    }
    String xmlElemNS = null;
    if (xmlElem != null && !xmlElem.namespace().equals("##default")) {
        xmlElemNS = xmlElem.namespace();
    }
    if (xmlElemNS != null && webParamNS != null && !xmlElemNS.equals(webParamNS)) {
        throw new RuntimeModelerException("@XmlElement(namespace)="+xmlElemNS+" and @WebParam(targetNamespace)="+webParamNS+" are different for method " +method);
    }
    String ns = "";
    if (webParamNS != null) {
        ns = webParamNS;
    } else if (xmlElemNS != null) {
        ns =  xmlElemNS;
    }

    return new QName(ns, localPart);
}
 
Example 6
Source File: RuntimeModeler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static QName getReturnQName(Method method, WebResult webResult, XmlElement xmlElem) {
    String webResultName = null;
    if (webResult != null && webResult.name().length() > 0) {
        webResultName = webResult.name();
    }
    String xmlElemName = null;
    if (xmlElem != null && !xmlElem.name().equals("##default")) {
        xmlElemName = xmlElem.name();
    }
    if (xmlElemName != null && webResultName != null && !xmlElemName.equals(webResultName)) {
        throw new RuntimeModelerException("@XmlElement(name)="+xmlElemName+" and @WebResult(name)="+webResultName+" are different for method " +method);
    }
    String localPart = RETURN;
    if (webResultName != null) {
        localPart = webResultName;
    } else if (xmlElemName != null) {
        localPart =  xmlElemName;
    }

    String webResultNS = null;
    if (webResult != null && webResult.targetNamespace().length() > 0) {
        webResultNS = webResult.targetNamespace();
    }
    String xmlElemNS = null;
    if (xmlElem != null && !xmlElem.namespace().equals("##default")) {
        xmlElemNS = xmlElem.namespace();
    }
    if (xmlElemNS != null && webResultNS != null && !xmlElemNS.equals(webResultNS)) {
        throw new RuntimeModelerException("@XmlElement(namespace)="+xmlElemNS+" and @WebResult(targetNamespace)="+webResultNS+" are different for method " +method);
    }
    String ns = "";
    if (webResultNS != null) {
        ns = webResultNS;
    } else if (xmlElemNS != null) {
        ns =  xmlElemNS;
    }

    return new QName(ns, localPart);
}
 
Example 7
Source File: RuntimeModeler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static QName getParameterQName(Method method, WebParam webParam, XmlElement xmlElem, String paramDefault) {
    String webParamName = null;
    if (webParam != null && webParam.name().length() > 0) {
        webParamName = webParam.name();
    }
    String xmlElemName = null;
    if (xmlElem != null && !xmlElem.name().equals("##default")) {
        xmlElemName = xmlElem.name();
    }
    if (xmlElemName != null && webParamName != null && !xmlElemName.equals(webParamName)) {
        throw new RuntimeModelerException("@XmlElement(name)="+xmlElemName+" and @WebParam(name)="+webParamName+" are different for method " +method);
    }
    String localPart = paramDefault;
    if (webParamName != null) {
        localPart = webParamName;
    } else if (xmlElemName != null) {
        localPart =  xmlElemName;
    }

    String webParamNS = null;
    if (webParam != null && webParam.targetNamespace().length() > 0) {
        webParamNS = webParam.targetNamespace();
    }
    String xmlElemNS = null;
    if (xmlElem != null && !xmlElem.namespace().equals("##default")) {
        xmlElemNS = xmlElem.namespace();
    }
    if (xmlElemNS != null && webParamNS != null && !xmlElemNS.equals(webParamNS)) {
        throw new RuntimeModelerException("@XmlElement(namespace)="+xmlElemNS+" and @WebParam(targetNamespace)="+webParamNS+" are different for method " +method);
    }
    String ns = "";
    if (webParamNS != null) {
        ns = webParamNS;
    } else if (xmlElemNS != null) {
        ns =  xmlElemNS;
    }

    return new QName(ns, localPart);
}
 
Example 8
Source File: RuntimeModeler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static QName getReturnQName(Method method, WebResult webResult, XmlElement xmlElem) {
    String webResultName = null;
    if (webResult != null && webResult.name().length() > 0) {
        webResultName = webResult.name();
    }
    String xmlElemName = null;
    if (xmlElem != null && !xmlElem.name().equals("##default")) {
        xmlElemName = xmlElem.name();
    }
    if (xmlElemName != null && webResultName != null && !xmlElemName.equals(webResultName)) {
        throw new RuntimeModelerException("@XmlElement(name)="+xmlElemName+" and @WebResult(name)="+webResultName+" are different for method " +method);
    }
    String localPart = RETURN;
    if (webResultName != null) {
        localPart = webResultName;
    } else if (xmlElemName != null) {
        localPart =  xmlElemName;
    }

    String webResultNS = null;
    if (webResult != null && webResult.targetNamespace().length() > 0) {
        webResultNS = webResult.targetNamespace();
    }
    String xmlElemNS = null;
    if (xmlElem != null && !xmlElem.namespace().equals("##default")) {
        xmlElemNS = xmlElem.namespace();
    }
    if (xmlElemNS != null && webResultNS != null && !xmlElemNS.equals(webResultNS)) {
        throw new RuntimeModelerException("@XmlElement(namespace)="+xmlElemNS+" and @WebResult(targetNamespace)="+webResultNS+" are different for method " +method);
    }
    String ns = "";
    if (webResultNS != null) {
        ns = webResultNS;
    } else if (xmlElemNS != null) {
        ns =  xmlElemNS;
    }

    return new QName(ns, localPart);
}
 
Example 9
Source File: RuntimeModeler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static QName getParameterQName(Method method, WebParam webParam, XmlElement xmlElem, String paramDefault) {
    String webParamName = null;
    if (webParam != null && webParam.name().length() > 0) {
        webParamName = webParam.name();
    }
    String xmlElemName = null;
    if (xmlElem != null && !xmlElem.name().equals("##default")) {
        xmlElemName = xmlElem.name();
    }
    if (xmlElemName != null && webParamName != null && !xmlElemName.equals(webParamName)) {
        throw new RuntimeModelerException("@XmlElement(name)="+xmlElemName+" and @WebParam(name)="+webParamName+" are different for method " +method);
    }
    String localPart = paramDefault;
    if (webParamName != null) {
        localPart = webParamName;
    } else if (xmlElemName != null) {
        localPart =  xmlElemName;
    }

    String webParamNS = null;
    if (webParam != null && webParam.targetNamespace().length() > 0) {
        webParamNS = webParam.targetNamespace();
    }
    String xmlElemNS = null;
    if (xmlElem != null && !xmlElem.namespace().equals("##default")) {
        xmlElemNS = xmlElem.namespace();
    }
    if (xmlElemNS != null && webParamNS != null && !xmlElemNS.equals(webParamNS)) {
        throw new RuntimeModelerException("@XmlElement(namespace)="+xmlElemNS+" and @WebParam(targetNamespace)="+webParamNS+" are different for method " +method);
    }
    String ns = "";
    if (webParamNS != null) {
        ns = webParamNS;
    } else if (xmlElemNS != null) {
        ns =  xmlElemNS;
    }

    return new QName(ns, localPart);
}
 
Example 10
Source File: RuntimeModeler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static QName getReturnQName(Method method, WebResult webResult, XmlElement xmlElem) {
    String webResultName = null;
    if (webResult != null && webResult.name().length() > 0) {
        webResultName = webResult.name();
    }
    String xmlElemName = null;
    if (xmlElem != null && !xmlElem.name().equals("##default")) {
        xmlElemName = xmlElem.name();
    }
    if (xmlElemName != null && webResultName != null && !xmlElemName.equals(webResultName)) {
        throw new RuntimeModelerException("@XmlElement(name)="+xmlElemName+" and @WebResult(name)="+webResultName+" are different for method " +method);
    }
    String localPart = RETURN;
    if (webResultName != null) {
        localPart = webResultName;
    } else if (xmlElemName != null) {
        localPart =  xmlElemName;
    }

    String webResultNS = null;
    if (webResult != null && webResult.targetNamespace().length() > 0) {
        webResultNS = webResult.targetNamespace();
    }
    String xmlElemNS = null;
    if (xmlElem != null && !xmlElem.namespace().equals("##default")) {
        xmlElemNS = xmlElem.namespace();
    }
    if (xmlElemNS != null && webResultNS != null && !xmlElemNS.equals(webResultNS)) {
        throw new RuntimeModelerException("@XmlElement(namespace)="+xmlElemNS+" and @WebResult(targetNamespace)="+webResultNS+" are different for method " +method);
    }
    String ns = "";
    if (webResultNS != null) {
        ns = webResultNS;
    } else if (xmlElemNS != null) {
        ns =  xmlElemNS;
    }

    return new QName(ns, localPart);
}
 
Example 11
Source File: RuntimeModeler.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static QName getReturnQName(Method method, WebResult webResult, XmlElement xmlElem) {
    String webResultName = null;
    if (webResult != null && webResult.name().length() > 0) {
        webResultName = webResult.name();
    }
    String xmlElemName = null;
    if (xmlElem != null && !xmlElem.name().equals("##default")) {
        xmlElemName = xmlElem.name();
    }
    if (xmlElemName != null && webResultName != null && !xmlElemName.equals(webResultName)) {
        throw new RuntimeModelerException("@XmlElement(name)="+xmlElemName+" and @WebResult(name)="+webResultName+" are different for method " +method);
    }
    String localPart = RETURN;
    if (webResultName != null) {
        localPart = webResultName;
    } else if (xmlElemName != null) {
        localPart =  xmlElemName;
    }

    String webResultNS = null;
    if (webResult != null && webResult.targetNamespace().length() > 0) {
        webResultNS = webResult.targetNamespace();
    }
    String xmlElemNS = null;
    if (xmlElem != null && !xmlElem.namespace().equals("##default")) {
        xmlElemNS = xmlElem.namespace();
    }
    if (xmlElemNS != null && webResultNS != null && !xmlElemNS.equals(webResultNS)) {
        throw new RuntimeModelerException("@XmlElement(namespace)="+xmlElemNS+" and @WebResult(targetNamespace)="+webResultNS+" are different for method " +method);
    }
    String ns = "";
    if (webResultNS != null) {
        ns = webResultNS;
    } else if (xmlElemNS != null) {
        ns =  xmlElemNS;
    }

    return new QName(ns, localPart);
}
 
Example 12
Source File: RuntimeModeler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static QName getReturnQName(Method method, WebResult webResult, XmlElement xmlElem) {
    String webResultName = null;
    if (webResult != null && webResult.name().length() > 0) {
        webResultName = webResult.name();
    }
    String xmlElemName = null;
    if (xmlElem != null && !xmlElem.name().equals("##default")) {
        xmlElemName = xmlElem.name();
    }
    if (xmlElemName != null && webResultName != null && !xmlElemName.equals(webResultName)) {
        throw new RuntimeModelerException("@XmlElement(name)="+xmlElemName+" and @WebResult(name)="+webResultName+" are different for method " +method);
    }
    String localPart = RETURN;
    if (webResultName != null) {
        localPart = webResultName;
    } else if (xmlElemName != null) {
        localPart =  xmlElemName;
    }

    String webResultNS = null;
    if (webResult != null && webResult.targetNamespace().length() > 0) {
        webResultNS = webResult.targetNamespace();
    }
    String xmlElemNS = null;
    if (xmlElem != null && !xmlElem.namespace().equals("##default")) {
        xmlElemNS = xmlElem.namespace();
    }
    if (xmlElemNS != null && webResultNS != null && !xmlElemNS.equals(webResultNS)) {
        throw new RuntimeModelerException("@XmlElement(namespace)="+xmlElemNS+" and @WebResult(targetNamespace)="+webResultNS+" are different for method " +method);
    }
    String ns = "";
    if (webResultNS != null) {
        ns = webResultNS;
    } else if (xmlElemNS != null) {
        ns =  xmlElemNS;
    }

    return new QName(ns, localPart);
}
 
Example 13
Source File: RuntimeModeler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static QName getParameterQName(Method method, WebParam webParam, XmlElement xmlElem, String paramDefault) {
    String webParamName = null;
    if (webParam != null && webParam.name().length() > 0) {
        webParamName = webParam.name();
    }
    String xmlElemName = null;
    if (xmlElem != null && !xmlElem.name().equals("##default")) {
        xmlElemName = xmlElem.name();
    }
    if (xmlElemName != null && webParamName != null && !xmlElemName.equals(webParamName)) {
        throw new RuntimeModelerException("@XmlElement(name)="+xmlElemName+" and @WebParam(name)="+webParamName+" are different for method " +method);
    }
    String localPart = paramDefault;
    if (webParamName != null) {
        localPart = webParamName;
    } else if (xmlElemName != null) {
        localPart =  xmlElemName;
    }

    String webParamNS = null;
    if (webParam != null && webParam.targetNamespace().length() > 0) {
        webParamNS = webParam.targetNamespace();
    }
    String xmlElemNS = null;
    if (xmlElem != null && !xmlElem.namespace().equals("##default")) {
        xmlElemNS = xmlElem.namespace();
    }
    if (xmlElemNS != null && webParamNS != null && !xmlElemNS.equals(webParamNS)) {
        throw new RuntimeModelerException("@XmlElement(namespace)="+xmlElemNS+" and @WebParam(targetNamespace)="+webParamNS+" are different for method " +method);
    }
    String ns = "";
    if (webParamNS != null) {
        ns = webParamNS;
    } else if (xmlElemNS != null) {
        ns =  xmlElemNS;
    }

    return new QName(ns, localPart);
}
 
Example 14
Source File: RuntimeModeler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static QName getReturnQName(Method method, WebResult webResult, XmlElement xmlElem) {
    String webResultName = null;
    if (webResult != null && webResult.name().length() > 0) {
        webResultName = webResult.name();
    }
    String xmlElemName = null;
    if (xmlElem != null && !xmlElem.name().equals("##default")) {
        xmlElemName = xmlElem.name();
    }
    if (xmlElemName != null && webResultName != null && !xmlElemName.equals(webResultName)) {
        throw new RuntimeModelerException("@XmlElement(name)="+xmlElemName+" and @WebResult(name)="+webResultName+" are different for method " +method);
    }
    String localPart = RETURN;
    if (webResultName != null) {
        localPart = webResultName;
    } else if (xmlElemName != null) {
        localPart =  xmlElemName;
    }

    String webResultNS = null;
    if (webResult != null && webResult.targetNamespace().length() > 0) {
        webResultNS = webResult.targetNamespace();
    }
    String xmlElemNS = null;
    if (xmlElem != null && !xmlElem.namespace().equals("##default")) {
        xmlElemNS = xmlElem.namespace();
    }
    if (xmlElemNS != null && webResultNS != null && !xmlElemNS.equals(webResultNS)) {
        throw new RuntimeModelerException("@XmlElement(namespace)="+xmlElemNS+" and @WebResult(targetNamespace)="+webResultNS+" are different for method " +method);
    }
    String ns = "";
    if (webResultNS != null) {
        ns = webResultNS;
    } else if (xmlElemNS != null) {
        ns =  xmlElemNS;
    }

    return new QName(ns, localPart);
}
 
Example 15
Source File: RuntimeModeler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static QName getParameterQName(Method method, WebParam webParam, XmlElement xmlElem, String paramDefault) {
    String webParamName = null;
    if (webParam != null && webParam.name().length() > 0) {
        webParamName = webParam.name();
    }
    String xmlElemName = null;
    if (xmlElem != null && !xmlElem.name().equals("##default")) {
        xmlElemName = xmlElem.name();
    }
    if (xmlElemName != null && webParamName != null && !xmlElemName.equals(webParamName)) {
        throw new RuntimeModelerException("@XmlElement(name)="+xmlElemName+" and @WebParam(name)="+webParamName+" are different for method " +method);
    }
    String localPart = paramDefault;
    if (webParamName != null) {
        localPart = webParamName;
    } else if (xmlElemName != null) {
        localPart =  xmlElemName;
    }

    String webParamNS = null;
    if (webParam != null && webParam.targetNamespace().length() > 0) {
        webParamNS = webParam.targetNamespace();
    }
    String xmlElemNS = null;
    if (xmlElem != null && !xmlElem.namespace().equals("##default")) {
        xmlElemNS = xmlElem.namespace();
    }
    if (xmlElemNS != null && webParamNS != null && !xmlElemNS.equals(webParamNS)) {
        throw new RuntimeModelerException("@XmlElement(namespace)="+xmlElemNS+" and @WebParam(targetNamespace)="+webParamNS+" are different for method " +method);
    }
    String ns = "";
    if (webParamNS != null) {
        ns = webParamNS;
    } else if (xmlElemNS != null) {
        ns =  xmlElemNS;
    }

    return new QName(ns, localPart);
}
 
Example 16
Source File: RuntimeModeler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static QName getReturnQName(Method method, WebResult webResult, XmlElement xmlElem) {
    String webResultName = null;
    if (webResult != null && webResult.name().length() > 0) {
        webResultName = webResult.name();
    }
    String xmlElemName = null;
    if (xmlElem != null && !xmlElem.name().equals("##default")) {
        xmlElemName = xmlElem.name();
    }
    if (xmlElemName != null && webResultName != null && !xmlElemName.equals(webResultName)) {
        throw new RuntimeModelerException("@XmlElement(name)="+xmlElemName+" and @WebResult(name)="+webResultName+" are different for method " +method);
    }
    String localPart = RETURN;
    if (webResultName != null) {
        localPart = webResultName;
    } else if (xmlElemName != null) {
        localPart =  xmlElemName;
    }

    String webResultNS = null;
    if (webResult != null && webResult.targetNamespace().length() > 0) {
        webResultNS = webResult.targetNamespace();
    }
    String xmlElemNS = null;
    if (xmlElem != null && !xmlElem.namespace().equals("##default")) {
        xmlElemNS = xmlElem.namespace();
    }
    if (xmlElemNS != null && webResultNS != null && !xmlElemNS.equals(webResultNS)) {
        throw new RuntimeModelerException("@XmlElement(namespace)="+xmlElemNS+" and @WebResult(targetNamespace)="+webResultNS+" are different for method " +method);
    }
    String ns = "";
    if (webResultNS != null) {
        ns = webResultNS;
    } else if (xmlElemNS != null) {
        ns =  xmlElemNS;
    }

    return new QName(ns, localPart);
}
 
Example 17
Source File: OverrideUtil.java    From tessera with Apache License 2.0 5 votes vote down vote up
static String resolveName(Field field) {
    if (!field.isAnnotationPresent(XmlElement.class)) {
        return field.getName();
    }
    final XmlElement xmlElement = field.getAnnotation(XmlElement.class);
    String name = xmlElement.name();
    return Objects.equals("##default", name) ? field.getName() : name;
}
 
Example 18
Source File: RuntimeModeler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static QName getParameterQName(Method method, WebParam webParam, XmlElement xmlElem, String paramDefault) {
    String webParamName = null;
    if (webParam != null && webParam.name().length() > 0) {
        webParamName = webParam.name();
    }
    String xmlElemName = null;
    if (xmlElem != null && !xmlElem.name().equals("##default")) {
        xmlElemName = xmlElem.name();
    }
    if (xmlElemName != null && webParamName != null && !xmlElemName.equals(webParamName)) {
        throw new RuntimeModelerException("@XmlElement(name)="+xmlElemName+" and @WebParam(name)="+webParamName+" are different for method " +method);
    }
    String localPart = paramDefault;
    if (webParamName != null) {
        localPart = webParamName;
    } else if (xmlElemName != null) {
        localPart =  xmlElemName;
    }

    String webParamNS = null;
    if (webParam != null && webParam.targetNamespace().length() > 0) {
        webParamNS = webParam.targetNamespace();
    }
    String xmlElemNS = null;
    if (xmlElem != null && !xmlElem.namespace().equals("##default")) {
        xmlElemNS = xmlElem.namespace();
    }
    if (xmlElemNS != null && webParamNS != null && !xmlElemNS.equals(webParamNS)) {
        throw new RuntimeModelerException("@XmlElement(namespace)="+xmlElemNS+" and @WebParam(targetNamespace)="+webParamNS+" are different for method " +method);
    }
    String ns = "";
    if (webParamNS != null) {
        ns = webParamNS;
    } else if (xmlElemNS != null) {
        ns =  xmlElemNS;
    }

    return new QName(ns, localPart);
}
 
Example 19
Source File: RuntimeModeler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static QName getReturnQName(Method method, WebResult webResult, XmlElement xmlElem) {
    String webResultName = null;
    if (webResult != null && webResult.name().length() > 0) {
        webResultName = webResult.name();
    }
    String xmlElemName = null;
    if (xmlElem != null && !xmlElem.name().equals("##default")) {
        xmlElemName = xmlElem.name();
    }
    if (xmlElemName != null && webResultName != null && !xmlElemName.equals(webResultName)) {
        throw new RuntimeModelerException("@XmlElement(name)="+xmlElemName+" and @WebResult(name)="+webResultName+" are different for method " +method);
    }
    String localPart = RETURN;
    if (webResultName != null) {
        localPart = webResultName;
    } else if (xmlElemName != null) {
        localPart =  xmlElemName;
    }

    String webResultNS = null;
    if (webResult != null && webResult.targetNamespace().length() > 0) {
        webResultNS = webResult.targetNamespace();
    }
    String xmlElemNS = null;
    if (xmlElem != null && !xmlElem.namespace().equals("##default")) {
        xmlElemNS = xmlElem.namespace();
    }
    if (xmlElemNS != null && webResultNS != null && !xmlElemNS.equals(webResultNS)) {
        throw new RuntimeModelerException("@XmlElement(namespace)="+xmlElemNS+" and @WebResult(targetNamespace)="+webResultNS+" are different for method " +method);
    }
    String ns = "";
    if (webResultNS != null) {
        ns = webResultNS;
    } else if (xmlElemNS != null) {
        ns =  xmlElemNS;
    }

    return new QName(ns, localPart);
}
 
Example 20
Source File: RuntimeModeler.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static QName getParameterQName(Method method, WebParam webParam, XmlElement xmlElem, String paramDefault) {
    String webParamName = null;
    if (webParam != null && webParam.name().length() > 0) {
        webParamName = webParam.name();
    }
    String xmlElemName = null;
    if (xmlElem != null && !xmlElem.name().equals("##default")) {
        xmlElemName = xmlElem.name();
    }
    if (xmlElemName != null && webParamName != null && !xmlElemName.equals(webParamName)) {
        throw new RuntimeModelerException("@XmlElement(name)="+xmlElemName+" and @WebParam(name)="+webParamName+" are different for method " +method);
    }
    String localPart = paramDefault;
    if (webParamName != null) {
        localPart = webParamName;
    } else if (xmlElemName != null) {
        localPart =  xmlElemName;
    }

    String webParamNS = null;
    if (webParam != null && webParam.targetNamespace().length() > 0) {
        webParamNS = webParam.targetNamespace();
    }
    String xmlElemNS = null;
    if (xmlElem != null && !xmlElem.namespace().equals("##default")) {
        xmlElemNS = xmlElem.namespace();
    }
    if (xmlElemNS != null && webParamNS != null && !xmlElemNS.equals(webParamNS)) {
        throw new RuntimeModelerException("@XmlElement(namespace)="+xmlElemNS+" and @WebParam(targetNamespace)="+webParamNS+" are different for method " +method);
    }
    String ns = "";
    if (webParamNS != null) {
        ns = webParamNS;
    } else if (xmlElemNS != null) {
        ns =  xmlElemNS;
    }

    return new QName(ns, localPart);
}