當前位置: 首頁>>代碼示例>>Java>>正文


Java XmlSeeAlso類代碼示例

本文整理匯總了Java中javax.xml.bind.annotation.XmlSeeAlso的典型用法代碼示例。如果您正苦於以下問題:Java XmlSeeAlso類的具體用法?Java XmlSeeAlso怎麽用?Java XmlSeeAlso使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


XmlSeeAlso類屬於javax.xml.bind.annotation包,在下文中一共展示了XmlSeeAlso類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: writeXmlSeeAlso

import javax.xml.bind.annotation.XmlSeeAlso; //導入依賴的package包/類
private void writeXmlSeeAlso(JDefinedClass cls) {
    if (model.getJAXBModel().getS2JJAXBModel() != null) {
        List<JClass> objectFactories = model.getJAXBModel().getS2JJAXBModel().getAllObjectFactories();

        //if there are no object facotires, dont generate @XmlSeeAlso
        if (objectFactories.isEmpty()) {
            return;
        }

        JAnnotationUse xmlSeeAlso = cls.annotate(cm.ref(XmlSeeAlso.class));
        JAnnotationArrayMember paramArray = xmlSeeAlso.paramArray("value");
        for (JClass of : objectFactories) {
            paramArray = paramArray.param(of);
        }
    }

}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:18,代碼來源:SeiGenerator.java

示例2: getFieldsOfSubTypes

import javax.xml.bind.annotation.XmlSeeAlso; //導入依賴的package包/類
private static LinkedList<FieldsOfSubType> getFieldsOfSubTypes(Class<?> thisType, StubTypeTreeRepository typeTreeRepository) {
	LinkedList<FieldsOfSubType> fieldsOfAllSubTypes = new LinkedList<FieldsOfSubType>();

	if (!thisType.isAnnotationPresent(XmlSeeAlso.class)) {
		return fieldsOfAllSubTypes;
	}

	List<Class<?>> subTypes = getSubTypes(thisType);

	registerToStubTypeTree(thisType, typeTreeRepository, subTypes);

	for (Class<?> subType : subTypes) {

		FieldsOfSubType fieldsOfSubType = new FieldsOfSubType(subType);
		fieldsOfSubType.addAll(Arrays.asList(subType.getDeclaredFields()));
		LinkedList<FieldsOfSubType> fieldsOfGrandSonType = getFieldsOfSubTypes(subType, typeTreeRepository);
		fieldsOfAllSubTypes.add(fieldsOfSubType);
		fieldsOfAllSubTypes.addAll(fieldsOfGrandSonType);
	}

	return fieldsOfAllSubTypes;
}
 
開發者ID:chenjianjx,項目名稱:wsdl2html,代碼行數:23,代碼來源:Variable2Stub.java

示例3: collectXmlTypes

import javax.xml.bind.annotation.XmlSeeAlso; //導入依賴的package包/類
/**
 * Traverse XML data object hierarchy and collect all descendants of a root class.
 *
 * @param rootClass root class of type hierarchy
 * @param clazz type class to be processed
 * @param classes set to collect type classes
 */
public static void collectXmlTypes(Class<?> rootClass, Class<?> clazz, Set<Class<?>> classes) {
    if (classes.contains(clazz)) {
        return;
    }

    if (clazz != rootClass && rootClass.isAssignableFrom(clazz) && !Modifier.isAbstract(clazz.getModifiers())) {
        classes.add(clazz);
    }

    XmlSeeAlso xmlSeeAlso = clazz.getAnnotation(XmlSeeAlso.class);
    if (xmlSeeAlso != null) {
        Collection<Class<?>> referencedClasses = new HashSet<>(Arrays.<Class<?>>asList(xmlSeeAlso.value()));
        for (Class<?> referencedClass : referencedClasses) {
            collectXmlTypes(rootClass, referencedClass, classes);
        }
    }
}
 
開發者ID:Talend,項目名稱:components,代碼行數:25,代碼來源:TypeUtils.java

示例4: writeXmlSeeAlso

import javax.xml.bind.annotation.XmlSeeAlso; //導入依賴的package包/類
private void writeXmlSeeAlso(JDefinedClass cls) {
    if (model.getJAXBModel().getS2JJAXBModel() != null) {
        List<JClass> objectFactories = model.getJAXBModel().getS2JJAXBModel().getAllObjectFactories();

        //if there are no object facotires, dont generate @XmlSeeAlso
        if(objectFactories.size() == 0)
            return;

        JAnnotationUse xmlSeeAlso = cls.annotate(cm.ref(XmlSeeAlso.class));
        JAnnotationArrayMember paramArray = xmlSeeAlso.paramArray("value");
        for (JClass of : objectFactories) {
            paramArray = paramArray.param(of);
        }
    }

}
 
開發者ID:alexkasko,項目名稱:openjdk-icedtea7,代碼行數:17,代碼來源:SeiGenerator.java

示例5: valueForMutableLocatable

import javax.xml.bind.annotation.XmlSeeAlso; //導入依賴的package包/類
private static MutableLocatable<?> valueForMutableLocatable(Class<?> clazz) throws Exception {
    Class<?> currentClass = clazz;
    while (true) {
        if (Modifier.isAbstract(currentClass.getModifiers())) {
            XmlSeeAlso annotation = currentClass.getAnnotation(XmlSeeAlso.class);
            Assert.assertNotNull(annotation, String.format("Missing @%s annotation on %s.",
                XmlSeeAlso.class.getSimpleName(), currentClass));
            currentClass = (Class<?>) annotation.value()[0];
        } else {
            return (MutableLocatable<?>) currentClass.getConstructor().newInstance();
        }
    }
}
 
開發者ID:cloudkeeper-project,項目名稱:cloudkeeper,代碼行數:14,代碼來源:MutableLocatableContract.java

示例6: getSubTypes

import javax.xml.bind.annotation.XmlSeeAlso; //導入依賴的package包/類
private static List<Class<?>> getSubTypes(Class<?> thisType) {
	List<Class<?>> subTypes = new ArrayList<Class<?>>();
	for (Class<?> subType : thisType.getAnnotation(XmlSeeAlso.class).value()) {
		if (thisType.isAssignableFrom(subType)) {
			subTypes.add(subType);
		}
	}
	return subTypes;
}
 
開發者ID:chenjianjx,項目名稱:wsdl2html,代碼行數:10,代碼來源:Variable2Stub.java

示例7: create

import javax.xml.bind.annotation.XmlSeeAlso; //導入依賴的package包/類
static AnnotationDesc create(Class cls) {
    AnnotationDescImpl aDesc = new AnnotationDescImpl();

    // XMLSeeAlso is part of JAXB 2.1.2.  
    // The assumption is that this is a prereq for JAXWS 2.1; thus
    // we can safely reference this class
    XmlSeeAlso xmlSeeAlso = (XmlSeeAlso)
        getAnnotation(cls, XmlSeeAlso.class);
    
    if (xmlSeeAlso != null) {
        aDesc._XmlSeeAlsoClasses = xmlSeeAlso.value();
    }
    
    QName qName = XMLRootElementUtil.getXmlRootElementQName(cls);
    if (qName != null) {
        aDesc._hasXmlRootElement = true;
        aDesc._XmlRootElementName = qName.getLocalPart();
        aDesc._XmlRootElementNamespace = qName.getNamespaceURI();
    }
    
    qName = XMLRootElementUtil.getXmlTypeQName(cls);
    if (qName != null) {
        aDesc._hasXmlType = true;
        aDesc._XmlTypeName = qName.getLocalPart();
        aDesc._XmlTypeNamespace = qName.getNamespaceURI();
    }
    return aDesc;
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:29,代碼來源:AnnotationDescImpl.java

示例8: xmlSeeAlso

import javax.xml.bind.annotation.XmlSeeAlso; //導入依賴的package包/類
/**
 * Create new <tt>XmlSeeAlso</tt> annotation.
 * @param file Javassist file to work with
 * @param types The class to refer to
 * @return The annotation
 */
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
private static Annotation xmlSeeAlso(final ClassFile file,
    final Collection<Class<?>> types) {
    final Annotation annotation = new Annotation(
        XmlSeeAlso.class.getName(),
        file.getConstPool()
    );
    final ArrayMemberValue member = new ArrayMemberValue(
        file.getConstPool()
    );
    final ClassMemberValue[] values = new ClassMemberValue[types.size()];
    int pos = 0;
    for (final Class<?> type : types) {
        values[pos] = new ClassMemberValue(
            type.getName(),
            file.getConstPool()
        );
        pos += 1;
    }
    member.setValue(values);
    annotation.addMemberValue("value", member);
    Logger.debug(
        JaxbGroup.class,
        "#xmlSeeAlso(.., %d classes): annotation created",
        types.size()
    );
    return annotation;
}
 
開發者ID:yegor256,項目名稱:rexsl,代碼行數:35,代碼來源:JaxbGroup.java

示例9: processClass

import javax.xml.bind.annotation.XmlSeeAlso; //導入依賴的package包/類
void processClass(Class clazz) {
        classUsesWebMethod = new HashSet<Class>();
        determineWebMethodUse(clazz);
        WebService webService = getAnnotation(clazz, WebService.class);
        QName portTypeName = getPortTypeName(clazz, targetNamespace, metadataReader);
//        String portTypeLocalName  = clazz.getSimpleName();
//        if (webService.name().length() >0)
//            portTypeLocalName = webService.name();
//
//        targetNamespace = webService.targetNamespace();
        packageName = "";
        if (clazz.getPackage() != null)
            packageName = clazz.getPackage().getName();
//        if (targetNamespace.length() == 0) {
//            targetNamespace = getNamespace(packageName);
//        }
//        model.setTargetNamespace(targetNamespace);
//        QName portTypeName = new QName(targetNamespace, portTypeLocalName);
        targetNamespace = portTypeName.getNamespaceURI();
        model.setPortTypeName(portTypeName);
        model.setTargetNamespace(targetNamespace);
        model.defaultSchemaNamespaceSuffix = config.getMappingInfo().getDefaultSchemaNamespaceSuffix();
        model.setWSDLLocation(webService.wsdlLocation());

        SOAPBinding soapBinding = getAnnotation(clazz, SOAPBinding.class);
        if (soapBinding != null) {
            if (soapBinding.style() == SOAPBinding.Style.RPC && soapBinding.parameterStyle() == SOAPBinding.ParameterStyle.BARE) {
                throw new RuntimeModelerException("runtime.modeler.invalid.soapbinding.parameterstyle",
                        soapBinding, clazz);

            }
            isWrapped = soapBinding.parameterStyle()== WRAPPED;
        }
        defaultBinding = createBinding(soapBinding);
        /*
         * if clazz != portClass then there is an SEI.  If there is an
         * SEI, then all methods should be processed.  However, if there is
         * no SEI, and the implementation class uses at least one
         * WebMethod annotation, then only methods with this annotation
         * will be processed.
         */
/*        if (clazz == portClass) {
            WebMethod webMethod;
            for (Method method : clazz.getMethods()) {
                webMethod = getPrivMethodAnnotation(method, WebMethod.class);
                if (webMethod != null &&
                    !webMethod.exclude()) {
                    usesWebMethod = true;
                    break;
                }
            }
        }*/

        for (Method method : clazz.getMethods()) {
            if (!clazz.isInterface()) {     // if clazz is SEI, then all methods are web methods
                if (method.getDeclaringClass() == Object.class) continue;
                if (!getBooleanSystemProperty("com.sun.xml.internal.ws.legacyWebMethod")) {  // legacy webMethod computation behaviour to be used
                    if (!isWebMethodBySpec(method, clazz))
                        continue;
                } else {
                    if (!isWebMethod(method))
                        continue;
                }
            }
            // TODO: binding can be null. We need to figure out how to post-process
            // RuntimeModel to link to WSDLModel
            processMethod(method);
        }
        //Add additional jaxb classes referenced by {@link XmlSeeAlso}
        XmlSeeAlso xmlSeeAlso = getAnnotation(clazz, XmlSeeAlso.class);
        if(xmlSeeAlso != null)
            model.addAdditionalClasses(xmlSeeAlso.value());
    }
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:74,代碼來源:RuntimeModeler.java

示例10: processClass

import javax.xml.bind.annotation.XmlSeeAlso; //導入依賴的package包/類
void processClass(Class clazz) {
        WebService webService = getPrivClassAnnotation(clazz, WebService.class);
        String portTypeLocalName  = clazz.getSimpleName();
        if (webService.name().length() >0)
            portTypeLocalName = webService.name();


        targetNamespace = webService.targetNamespace();
        packageName = "";
        if (clazz.getPackage() != null)
            packageName = clazz.getPackage().getName();
        if (targetNamespace.length() == 0) {
            targetNamespace = getNamespace(packageName);
        }
        model.setTargetNamespace(targetNamespace);
        QName portTypeName = new QName(targetNamespace, portTypeLocalName);
        model.setPortTypeName(portTypeName);
        model.setWSDLLocation(webService.wsdlLocation());

        SOAPBinding soapBinding = getPrivClassAnnotation(clazz, SOAPBinding.class);
        if (soapBinding != null) {
            if (soapBinding.style() == SOAPBinding.Style.RPC && soapBinding.parameterStyle() == SOAPBinding.ParameterStyle.BARE) {
                throw new RuntimeModelerException("runtime.modeler.invalid.soapbinding.parameterstyle",
                        soapBinding, clazz);

            }
            isWrapped = soapBinding.parameterStyle()== WRAPPED;
        }
        defaultBinding = createBinding(soapBinding);
        /*
         * if clazz != portClass then there is an SEI.  If there is an
         * SEI, then all methods should be processed.  However, if there is
         * no SEI, and the implementation class uses at least one
         * WebMethod annotation, then only methods with this annotation
         * will be processed.
         */
/*        if (clazz == portClass) {
            WebMethod webMethod;
            for (Method method : clazz.getMethods()) {
                webMethod = getPrivMethodAnnotation(method, WebMethod.class);
                if (webMethod != null &&
                    !webMethod.exclude()) {
                    usesWebMethod = true;
                    break;
                }
            }
        }*/

        for (Method method : clazz.getMethods()) {
            if (!clazz.isInterface()) {     // if clazz is SEI, then all methods are web methods
                if (!isWebMethodBySpec(method, clazz)) {
                    continue;
                }
            }
            // TODO: binding can be null. We need to figure out how to post-process
            // RuntimeModel to link to WSDLModel
            processMethod(method);
        }
        //Add additional jaxb classes referenced by {@link XmlSeeAlso}
        XmlSeeAlso xmlSeeAlso = getPrivClassAnnotation(clazz, XmlSeeAlso.class);
        if(xmlSeeAlso != null)
            model.addAdditionalClasses(xmlSeeAlso.value());
    }
 
開發者ID:alexkasko,項目名稱:openjdk-icedtea7,代碼行數:64,代碼來源:RuntimeModeler.java

示例11: visit

import javax.xml.bind.annotation.XmlSeeAlso; //導入依賴的package包/類
@Override
public void visit(AttributeCategory attributeCategory) {
    XmlSeeAlso annotation = BaseChildEditorElement.class.getAnnotation(XmlSeeAlso.class);
    addMenuEntry(manager, annotation, attributeCategory);
}
 
開發者ID:mulesoft,項目名稱:mule-tooling-incubator,代碼行數:6,代碼來源:MenuOptionsProvider.java

示例12: addMenuEntry

import javax.xml.bind.annotation.XmlSeeAlso; //導入依賴的package包/類
private void addMenuEntry(IMenuManager manager, XmlSeeAlso annotation, final Object object) {
    for (final Class<?> extended : annotation.value()) {
        if (Modifier.isAbstract(extended.getModifiers())) {
            XmlSeeAlso innerAnnotation = extended.getAnnotation(XmlSeeAlso.class);
            if (innerAnnotation != null) {
                MenuManager subMenu = new MenuManager(extended.getSimpleName(), extended.getCanonicalName());
                manager.add(subMenu);
                addMenuEntry(subMenu, innerAnnotation, object);
            }
        } else {
            manager.add(new Action() {

                @Override
                public void run() {
                    try {
                        if (object instanceof Nested) {
                            ((Nested) object).getChildElements().add((BaseChildEditorElement) extended.newInstance());
                        } else if (object instanceof Namespace) {
                            ((Namespace) object).getComponents().add((EditorElement) extended.newInstance());
                        } else if (object instanceof Group) {
                            ((Group) object).getChilds().add((BaseFieldEditorElement) extended.newInstance());

                        } else if (object instanceof Horizontal) {
                            ((Horizontal) object).getChilds().add((BaseFieldEditorElement) extended.newInstance());
                        } else if (object instanceof AttributeCategory) {
                            ((AttributeCategory) object).getChilds().add((BaseFieldEditorElement) extended.newInstance());
                        }
                        viewer.refresh();
                    } catch (InstantiationException | IllegalAccessException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }

                @Override
                public String getText() {
                    return "Add " + extended.getSimpleName();
                }

            });
        }
    }
}
 
開發者ID:mulesoft,項目名稱:mule-tooling-incubator,代碼行數:44,代碼來源:MenuOptionsProvider.java


注:本文中的javax.xml.bind.annotation.XmlSeeAlso類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。