当前位置: 首页>>代码示例>>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;未经允许,请勿转载。