• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Reference类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.tools.internal.xjc.api.Reference的典型用法代码示例。如果您正苦于以下问题:Java Reference类的具体用法?Java Reference怎么用?Java Reference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Reference类属于com.sun.tools.internal.xjc.api包,在下文中一共展示了Reference类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getSchemaGenerator

import com.sun.tools.internal.xjc.api.Reference; //导入依赖的package包/类
private synchronized XmlSchemaGenerator<TypeMirror, TypeElement, VariableElement, ExecutableElement> getSchemaGenerator() {
    if(xsdgen==null) {
        xsdgen = new XmlSchemaGenerator<TypeMirror, TypeElement, VariableElement, ExecutableElement>(types.getNavigator(), types);

        for (Map.Entry<QName, Reference> e : additionalElementDecls.entrySet()) {
            Reference value = e.getValue();
            if(value!=null) {
                NonElement<TypeMirror, TypeElement> typeInfo = refMap.get(value);
                if(typeInfo==null)
                    throw new IllegalArgumentException(e.getValue()+" was not specified to JavaCompiler.bind");
                TypeMirror type = value.type;
                xsdgen.add(e.getKey(), !(type != null && type.getKind().isPrimitive()), typeInfo);
            } else {
                xsdgen.add(e.getKey(),false,null);
            }
        }
    }
    return xsdgen;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:JAXBModelImpl.java


示例2: getSchemaGenerator

import com.sun.tools.internal.xjc.api.Reference; //导入依赖的package包/类
private synchronized XmlSchemaGenerator<TypeMirror, TypeDeclaration, FieldDeclaration, MethodDeclaration> getSchemaGenerator() {
    if(xsdgen==null) {
        xsdgen = new XmlSchemaGenerator<TypeMirror,TypeDeclaration,FieldDeclaration,MethodDeclaration>( types.getNavigator(), types );

        for (Map.Entry<QName, Reference> e : additionalElementDecls.entrySet()) {
            Reference value = e.getValue();
            if(value!=null) {
                NonElement<TypeMirror, TypeDeclaration> typeInfo = refMap.get(value);
                if(typeInfo==null)
                    throw new IllegalArgumentException(e.getValue()+" was not specified to JavaCompiler.bind");
                xsdgen.add(e.getKey(),!(value.type instanceof PrimitiveType),typeInfo);
            } else {
                xsdgen.add(e.getKey(),false,null);
            }
        }
    }
    return xsdgen;
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:19,代码来源:JAXBModelImpl.java


示例3: bind

import com.sun.tools.internal.xjc.api.Reference; //导入依赖的package包/类
public J2SJAXBModel bind(
    Collection<Reference> rootClasses,
    Map<QName,Reference> additionalElementDecls,
    String defaultNamespaceRemap,
    ProcessingEnvironment env) {

    ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement> builder =
            new ModelBuilder<TypeMirror, TypeElement, VariableElement, ExecutableElement>(
            InlineAnnotationReaderImpl.theInstance,
            new ApNavigator(env),
            Collections.<TypeElement, TypeElement>emptyMap(),
            defaultNamespaceRemap );

    builder.setErrorHandler(new ErrorHandlerImpl(env.getMessager()));

    for ( Reference ref : rootClasses ) {
        TypeMirror t = ref.type;

        XmlJavaTypeAdapter xjta = ref.annotations.getAnnotation(XmlJavaTypeAdapter.class);
        XmlList xl = ref.annotations.getAnnotation(XmlList.class);

        builder.getTypeInfo(new Ref<TypeMirror, TypeElement>(builder, t, xjta, xl));
    }

    TypeInfoSet<TypeMirror, TypeElement, VariableElement, ExecutableElement> r = builder.link();
    if(r==null)     return null;

    if(additionalElementDecls==null)
        additionalElementDecls = Collections.emptyMap();
    else {
        // fool proof check
        for (Map.Entry<QName, ? extends Reference> e : additionalElementDecls.entrySet()) {
            if(e.getKey()==null)
                throw new IllegalArgumentException("nulls in additionalElementDecls");
        }
    }
    return new JAXBModelImpl(r, builder.reader, rootClasses, new HashMap<QName, Reference>(additionalElementDecls));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:JavaCompilerImpl.java


示例4: getXmlTypeName

import com.sun.tools.internal.xjc.api.Reference; //导入依赖的package包/类
public QName getXmlTypeName(Reference javaType) {
    NonElement<TypeMirror, TypeElement> ti = refMap.get(javaType);

    if(ti!=null)
        return ti.getTypeName();

    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:JAXBModelImpl.java


示例5: getXmlType

import com.sun.tools.internal.xjc.api.Reference; //导入依赖的package包/类
private NonElement<TypeMirror, TypeElement> getXmlType(Reference r) {
    if(r==null)
        throw new IllegalArgumentException();

    XmlJavaTypeAdapter xjta = r.annotations.getAnnotation(XmlJavaTypeAdapter.class);
    XmlList xl = r.annotations.getAnnotation(XmlList.class);

    Ref<TypeMirror, TypeElement> ref = new Ref<TypeMirror, TypeElement>(
        reader,types.getNavigator(),r.type,xjta,xl);

    return types.getTypeInfo(ref);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:JAXBModelImpl.java


示例6: filterClass

import com.sun.tools.internal.xjc.api.Reference; //导入依赖的package包/类
private void filterClass(List<Reference> classes, Collection<? extends Element> elements) {
    for (Element element : elements) {
        if (element.getKind().equals(ElementKind.CLASS) || element.getKind().equals(ElementKind.ENUM)) {
            classes.add(new Reference((TypeElement) element, processingEnv));
            filterClass(classes, ElementFilter.typesIn(element.getEnclosedElements()));
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:SchemaGenerator.java


示例7: filterClass

import com.sun.tools.internal.xjc.api.Reference; //导入依赖的package包/类
/**
 * Filter classes (note that enum is kind of class) from elements tree
 * @param result list of found classes
 * @param elements tree to be filtered
 */
private void filterClass(List<Reference> result, Collection<? extends Element> elements) {
    for (Element element : elements) {
        final ElementKind kind = element.getKind();
        if (ElementKind.CLASS.equals(kind) || ElementKind.ENUM.equals(kind)) {
            result.add(new Reference((TypeElement) element, processingEnv));
            filterClass(result, ElementFilter.typesIn(element.getEnclosedElements()));
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:SchemaGenerator.java


示例8: filterClass

import com.sun.tools.internal.xjc.api.Reference; //导入依赖的package包/类
private void filterClass(List<Reference> classes, Collection<? extends Element> elements) {
    for (Element element : elements) {
        if (element.getKind().equals(ElementKind.CLASS)) {
            classes.add(new Reference((TypeElement) element, processingEnv));
            filterClass(classes, ElementFilter.typesIn(element.getEnclosedElements()));
        }
    }
}
 
开发者ID:infobip,项目名称:infobip-open-jdk-8,代码行数:9,代码来源:SchemaGenerator.java


示例9: bind

import com.sun.tools.internal.xjc.api.Reference; //导入依赖的package包/类
public J2SJAXBModel bind(
    Collection<Reference> rootClasses,
    Map<QName,Reference> additionalElementDecls,
    String defaultNamespaceRemap,
    AnnotationProcessorEnvironment env) {

    ModelBuilder<TypeMirror,TypeDeclaration,FieldDeclaration,MethodDeclaration> builder =
        new ModelBuilder<TypeMirror,TypeDeclaration,FieldDeclaration,MethodDeclaration>(
            InlineAnnotationReaderImpl.theInstance,
            new APTNavigator(env),
            Collections.<TypeDeclaration,TypeDeclaration>emptyMap(),
            defaultNamespaceRemap );

    builder.setErrorHandler(new ErrorHandlerImpl(env.getMessager()));

    for( Reference ref : rootClasses ) {
        TypeMirror t = ref.type;

        XmlJavaTypeAdapter xjta = ref.annotations.getAnnotation(XmlJavaTypeAdapter.class);
        XmlList xl = ref.annotations.getAnnotation(XmlList.class);

        builder.getTypeInfo(new Ref<TypeMirror,TypeDeclaration>(builder,t,xjta,xl));
    }

    TypeInfoSet r = builder.link();
    if(r==null)     return null;

    if(additionalElementDecls==null)
        additionalElementDecls = Collections.emptyMap();
    else {
        // fool proof check
        for (Map.Entry<QName, ? extends Reference> e : additionalElementDecls.entrySet()) {
            if(e.getKey()==null)
                throw new IllegalArgumentException("nulls in additionalElementDecls");
        }
    }
    return new JAXBModelImpl(r,builder.reader,rootClasses,new HashMap(additionalElementDecls));
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:39,代码来源:JavaCompilerImpl.java


示例10: getXmlTypeName

import com.sun.tools.internal.xjc.api.Reference; //导入依赖的package包/类
public QName getXmlTypeName(Reference javaType) {
    NonElement<TypeMirror,TypeDeclaration> ti = refMap.get(javaType);

    if(ti!=null)
        return ti.getTypeName();

    return null;
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:9,代码来源:JAXBModelImpl.java


示例11: getXmlType

import com.sun.tools.internal.xjc.api.Reference; //导入依赖的package包/类
private NonElement<TypeMirror,TypeDeclaration> getXmlType(Reference r) {
    if(r==null)
        throw new IllegalArgumentException();

    XmlJavaTypeAdapter xjta = r.annotations.getAnnotation(XmlJavaTypeAdapter.class);
    XmlList xl = r.annotations.getAnnotation(XmlList.class);

    Ref<TypeMirror, TypeDeclaration> ref = new Ref<TypeMirror, TypeDeclaration>(
        reader,types.getNavigator(),r.type,xjta,xl);

    return types.getTypeInfo(ref);
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:13,代码来源:JAXBModelImpl.java


示例12: JAXBModelImpl

import com.sun.tools.internal.xjc.api.Reference; //导入依赖的package包/类
public JAXBModelImpl(TypeInfoSet<TypeMirror, TypeElement, VariableElement, ExecutableElement> types,
                     AnnotationReader<TypeMirror, TypeElement, VariableElement, ExecutableElement> reader,
                     Collection<Reference> rootClasses,
                     Map<QName, Reference> additionalElementDecls) {
    this.types = types;
    this.reader = reader;
    this.additionalElementDecls = additionalElementDecls;

    Navigator<TypeMirror, TypeElement, VariableElement, ExecutableElement> navigator = types.getNavigator();

    for (ClassInfo<TypeMirror, TypeElement> i : types.beans().values()) {
        classList.add(i.getName());
    }

    for (ArrayInfo<TypeMirror, TypeElement> a : types.arrays().values()) {
        String javaName = navigator.getTypeName(a.getType());
        classList.add(javaName);
    }

    for (EnumLeafInfo<TypeMirror, TypeElement> l : types.enums().values()) {
        QName tn = l.getTypeName();
        if(tn!=null) {
            String javaName = navigator.getTypeName(l.getType());
            classList.add(javaName);
        }
    }

    for (Reference ref : rootClasses)
        refMap.put(ref,getXmlType(ref));

    // check for collision between "additional" ones and the ones given to JAXB
    // and eliminate duplication
    Iterator<Map.Entry<QName, Reference>> itr = additionalElementDecls.entrySet().iterator();
    while(itr.hasNext()) {
        Map.Entry<QName, Reference> entry = itr.next();
        if(entry.getValue()==null)      continue;

        NonElement<TypeMirror, TypeElement> xt = getXmlType(entry.getValue());

        assert xt!=null;
        refMap.put(entry.getValue(),xt);
        if(xt instanceof ClassInfo) {
            ClassInfo<TypeMirror, TypeElement> xct = (ClassInfo<TypeMirror, TypeElement>) xt;
            Element<TypeMirror, TypeElement> elem = xct.asElement();
            if(elem!=null && elem.getElementName().equals(entry.getKey())) {
                itr.remove();
                continue;
            }
        }
        ElementInfo<TypeMirror, TypeElement> ei = types.getElementInfo(null, entry.getKey());
        if(ei!=null && ei.getContentType()==xt)
            itr.remove();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:55,代码来源:JAXBModelImpl.java


示例13: process

import com.sun.tools.internal.xjc.api.Reference; //导入依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    final ErrorReceiverImpl errorListener = new ErrorReceiverImpl(processingEnv);

    List<Reference> classesToBeBound = new ArrayList<Reference>();
    // simply ignore all the interface definitions,
    // so that users won't have to manually exclude interfaces, which is silly.
    filterClass(classesToBeBound, roundEnv.getRootElements());

    J2SJAXBModel model = JXC.createJavaCompiler().bind(classesToBeBound, Collections.<QName, Reference>emptyMap(), null, processingEnv);
    if (model == null)
        return false; // error

    try {
        model.generateSchema(
                new SchemaOutputResolver() {
                    public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException {
                        File file;
                        OutputStream out;
                        if (schemaLocations.containsKey(namespaceUri)) {
                            file = schemaLocations.get(namespaceUri);
                            if (file == null) return null;    // don't generate
                            out = new FileOutputStream(file);
                        } else {
                            // use the default
                            file = new File(suggestedFileName);
                            out = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", suggestedFileName)
                                    .openOutputStream();
                            file = file.getAbsoluteFile();
                        }

                        StreamResult ss = new StreamResult(out);
                        processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "Writing "+file);
                        ss.setSystemId(file.toURL().toExternalForm());
                        return ss;
                    }
                }, errorListener);

        if (episodeFile != null) {
            processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "Writing "+episodeFile);
            model.generateEpisodeFile(new StreamResult(episodeFile));
        }
    } catch (IOException e) {
        errorListener.error(e.getMessage(), e);
    }
    return false;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:48,代码来源:SchemaGenerator.java


示例14: process

import com.sun.tools.internal.xjc.api.Reference; //导入依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    final ErrorReceiverImpl errorListener = new ErrorReceiverImpl(processingEnv);

    List<Reference> classes = new ArrayList<Reference>();
    // simply ignore all the interface definitions,
    // so that users won't have to manually exclude interfaces, which is silly.
    filterClass(classes, roundEnv.getRootElements());

    J2SJAXBModel model = JXC.createJavaCompiler().bind(classes, Collections.<QName, Reference>emptyMap(), null, processingEnv);
    if (model == null)
        return false; // error

    try {
        model.generateSchema(
                new SchemaOutputResolver() {
                    public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException {
                        File file;
                        OutputStream out;
                        if (schemaLocations.containsKey(namespaceUri)) {
                            file = schemaLocations.get(namespaceUri);
                            if (file == null) return null;    // don't generate
                            out = new FileOutputStream(file);
                        } else {
                            // use the default
                            file = new File(suggestedFileName);
                            out = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", suggestedFileName)
                                    .openOutputStream();
                            file = file.getAbsoluteFile();
                        }

                        StreamResult ss = new StreamResult(out);
                        processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "Writing "+file);
                        ss.setSystemId(file.toURL().toExternalForm());
                        return ss;
                    }
                }, errorListener);

        if (episodeFile != null) {
            processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "Writing "+episodeFile);
            model.generateEpisodeFile(new StreamResult(episodeFile));
        }
    } catch (IOException e) {
        errorListener.error(e.getMessage(), e);
    }
    return false;
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:48,代码来源:SchemaGenerator.java



注:本文中的com.sun.tools.internal.xjc.api.Reference类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GlobalConstants类代码示例发布时间:2022-05-23
下一篇:
Java TransformerUtils类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap