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


Java XmlElementRef.name方法代碼示例

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


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

示例1: processOutputs

import javax.xml.bind.annotation.XmlElementRef; //導入方法依賴的package包/類
/**
 * Special for processing an @XmlElementRef outputs field
 */
private void processOutputs(RoundEnvironment roundEnv, TypeElement originalClassType, XmlElementRef elementRef,
                            VariableElement fieldElement, String fieldName, Set<EipOption> eipOptions, String prefix) {
    if ("outputs".equals(fieldName) && supportOutputs(originalClassType)) {
        String kind = "element";
        String name = elementRef.name();
        if (isNullOrEmpty(name) || "##default".equals(name)) {
            name = fieldName;
        }
        name = prefix + name;
        TypeMirror fieldType = fieldElement.asType();
        String fieldTypeName = fieldType.toString();

        // gather oneOf which extends any of the output base classes
        Set<String> oneOfTypes = new TreeSet<String>();
        // find all classes that has that superClassName
        Set<TypeElement> children = new LinkedHashSet<TypeElement>();
        for (String superclass : ONE_OF_OUTPUTS) {
            findTypeElementChildren(roundEnv, children, superclass);
        }
        for (TypeElement child : children) {
            XmlRootElement rootElement = child.getAnnotation(XmlRootElement.class);
            if (rootElement != null) {
                String childName = rootElement.name();
                if (childName != null) {
                    oneOfTypes.add(childName);
                }
            }
        }

        // remove some types which are not intended as an output in eips
        oneOfTypes.remove("route");

        EipOption ep = new EipOption(name, kind, fieldTypeName, true, "", "", false, false, null, true, oneOfTypes);
        eipOptions.add(ep);
    }
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:40,代碼來源:EipAnnotationProcessor.java

示例2: processVerbs

import javax.xml.bind.annotation.XmlElementRef; //導入方法依賴的package包/類
/**
 * Special for processing an @XmlElementRef verbs field (rest-dsl)
 */
private void processVerbs(RoundEnvironment roundEnv, TypeElement originalClassType, XmlElementRef elementRef,
                          VariableElement fieldElement, String fieldName, Set<EipOption> eipOptions, String prefix) {

    Elements elementUtils = processingEnv.getElementUtils();

    if ("verbs".equals(fieldName) && supportOutputs(originalClassType)) {
        String kind = "element";
        String name = elementRef.name();
        if (isNullOrEmpty(name) || "##default".equals(name)) {
            name = fieldName;
        }
        name = prefix + name;
        TypeMirror fieldType = fieldElement.asType();
        String fieldTypeName = fieldType.toString();

        String docComment = findJavaDoc(elementUtils, fieldElement, fieldName, name, originalClassType, true);

        // gather oneOf which extends any of the output base classes
        Set<String> oneOfTypes = new TreeSet<String>();
        // find all classes that has that superClassName
        Set<TypeElement> children = new LinkedHashSet<TypeElement>();
        for (String superclass : ONE_OF_VERBS) {
            findTypeElementChildren(roundEnv, children, superclass);
        }
        for (TypeElement child : children) {
            XmlRootElement rootElement = child.getAnnotation(XmlRootElement.class);
            if (rootElement != null) {
                String childName = rootElement.name();
                if (childName != null) {
                    oneOfTypes.add(childName);
                }
            }
        }

        EipOption ep = new EipOption(name, kind, fieldTypeName, true, "", docComment, false, false, null, true, oneOfTypes);
        eipOptions.add(ep);
    }
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:42,代碼來源:EipAnnotationProcessor.java

示例3: processRefWhenClauses

import javax.xml.bind.annotation.XmlElementRef; //導入方法依賴的package包/類
/**
 * Special for processing an @XmlElementRef when field
 */
private void processRefWhenClauses(RoundEnvironment roundEnv, TypeElement originalClassType, XmlElementRef elementRef,
                                   VariableElement fieldElement, String fieldName, Set<EipOption> eipOptions, String prefix) {
    Elements elementUtils = processingEnv.getElementUtils();

    if ("whenClauses".equals(fieldName)) {
        String kind = "element";
        String name = elementRef.name();
        if (isNullOrEmpty(name) || "##default".equals(name)) {
            name = fieldName;
        }
        name = prefix + name;
        TypeMirror fieldType = fieldElement.asType();
        String fieldTypeName = fieldType.toString();

        // find javadoc from original class as it will override the setExpression method where we can provide the javadoc for the given EIP
        String docComment = findJavaDoc(elementUtils, fieldElement, fieldName, name, originalClassType, true);
        boolean deprecated = fieldElement.getAnnotation(Deprecated.class) != null;

        // indicate that this element is one of when
        Set<String> oneOfTypes = new HashSet<String>();
        oneOfTypes.add("when");

        EipOption ep = new EipOption(name, kind, fieldTypeName, false, "", docComment, deprecated, false, null, true, oneOfTypes);
        eipOptions.add(ep);
    }
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:30,代碼來源:EipAnnotationProcessor.java

示例4: processRefExpression

import javax.xml.bind.annotation.XmlElementRef; //導入方法依賴的package包/類
/**
 * Special for processing an @XmlElementRef expression field
 */
private void processRefExpression(RoundEnvironment roundEnv, TypeElement originalClassType, TypeElement classElement,
                                  XmlElementRef elementRef, VariableElement fieldElement,
                                  String fieldName, Set<EipOption> eipOptions, String prefix) {
    Elements elementUtils = processingEnv.getElementUtils();

    if ("expression".equals(fieldName)) {
        String kind = "expression";
        String name = elementRef.name();
        if (isNullOrEmpty(name) || "##default".equals(name)) {
            name = fieldName;
        }
        name = prefix + name;
        TypeMirror fieldType = fieldElement.asType();
        String fieldTypeName = fieldType.toString();

        // find javadoc from original class as it will override the setExpression method where we can provide the javadoc for the given EIP
        String docComment = findJavaDoc(elementUtils, fieldElement, fieldName, name, originalClassType, true);

        // gather oneOf expression/predicates which uses language
        Set<String> oneOfTypes = new TreeSet<String>();
        for (String language : ONE_OF_LANGUAGES) {
            TypeElement languages = findTypeElement(roundEnv, language);
            String superClassName = canonicalClassName(languages.toString());
            // find all classes that has that superClassName
            Set<TypeElement> children = new LinkedHashSet<TypeElement>();
            findTypeElementChildren(roundEnv, children, superClassName);
            for (TypeElement child : children) {
                XmlRootElement rootElement = child.getAnnotation(XmlRootElement.class);
                if (rootElement != null) {
                    String childName = rootElement.name();
                    if (childName != null) {
                        oneOfTypes.add(childName);
                    }
                }
            }
        }

        boolean deprecated = fieldElement.getAnnotation(Deprecated.class) != null;

        EipOption ep = new EipOption(name, kind, fieldTypeName, true, "", docComment, deprecated, false, null, true, oneOfTypes);
        eipOptions.add(ep);
    }
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:47,代碼來源:EipAnnotationProcessor.java


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