Search in sources :

Example 1 with JavaStructureMember

use of com.sun.tools.ws.processor.model.java.JavaStructureMember in project metro-jax-ws by eclipse-ee4j.

the class ModelerUtils method isEquivalentLiteralStructures.

/**
 * Compares two JAXBStructures.
 *
 * @return true if struct1 and struct2 are equivalent.
 */
public static boolean isEquivalentLiteralStructures(JAXBStructuredType struct1, JAXBStructuredType struct2) {
    if (struct1.getElementMembersCount() != struct2.getElementMembersCount())
        return false;
    Iterator members = struct1.getElementMembers();
    JAXBElementMember member1;
    JavaStructureMember javaMember1, javaMember2;
    for (int i = 0; members.hasNext(); i++) {
        member1 = (JAXBElementMember) members.next();
        javaMember1 = member1.getJavaStructureMember();
        javaMember2 = ((JavaStructureType) struct2.getJavaType()).getMemberByName(member1.getJavaStructureMember().getName());
        if (javaMember2.getConstructorPos() != i || !javaMember1.getType().equals(javaMember2.getType())) {
            return false;
        }
    }
    return false;
}
Also used : Iterator(java.util.Iterator) JavaStructureMember(com.sun.tools.ws.processor.model.java.JavaStructureMember)

Example 2 with JavaStructureMember

use of com.sun.tools.ws.processor.model.java.JavaStructureMember in project metro-jax-ws by eclipse-ee4j.

the class ModelerUtils method createUnwrappedParameter.

/**
 * @return unwrapped parameter
 */
private static Parameter createUnwrappedParameter(JAXBProperty prop, JAXBType jaxbType, Block block, JAXBStructuredType type, JavaStructureType jst) {
    QName elementName = prop.getElementName();
    JavaType javaType = new JavaSimpleType(prop.getType());
    JAXBElementMember eType = new JAXBElementMember(elementName, jaxbType);
    JavaStructureMember jsm = new JavaStructureMember(elementName.getLocalPart(), javaType, eType);
    eType.setJavaStructureMember(jsm);
    jst.add(jsm);
    eType.setProperty(prop);
    type.add(eType);
    JAXBType t = new JAXBType(elementName, javaType, jaxbType.getJaxbMapping(), jaxbType.getJaxbModel());
    t.setUnwrapped(true);
    Parameter parameter = createParameter(elementName.getLocalPart(), t, block);
    parameter.setEmbedded(true);
    return parameter;
}
Also used : JavaType(com.sun.tools.ws.processor.model.java.JavaType) QName(javax.xml.namespace.QName) JavaSimpleType(com.sun.tools.ws.processor.model.java.JavaSimpleType) Parameter(com.sun.tools.ws.processor.model.Parameter) JavaStructureMember(com.sun.tools.ws.processor.model.java.JavaStructureMember)

Aggregations

JavaStructureMember (com.sun.tools.ws.processor.model.java.JavaStructureMember)2 Parameter (com.sun.tools.ws.processor.model.Parameter)1 JavaSimpleType (com.sun.tools.ws.processor.model.java.JavaSimpleType)1 JavaType (com.sun.tools.ws.processor.model.java.JavaType)1 Iterator (java.util.Iterator)1 QName (javax.xml.namespace.QName)1