当前位置: 首页>>代码示例>>Java>>正文


Java Type类代码示例

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


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

示例1: visitTypeParamType

import com.sun.tools.classfile.Type; //导入依赖的package包/类
public StringBuilder visitTypeParamType(TypeParamType type, StringBuilder sb) {
    sb.append(type.name);
    String sep = " extends ";
    if (type.classBound != null
            && (options.verbose || !type.classBound.isObject())) {
        sb.append(sep);
        append(sb, type.classBound);
        sep = " & ";
    }
    if (type.interfaceBounds != null) {
        for (Type bound: type.interfaceBounds) {
            sb.append(sep);
            append(sb, bound);
            sep = " & ";
        }
    }
    return sb;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:ClassWriter.java

示例2: visitTypeParamType

import com.sun.tools.classfile.Type; //导入依赖的package包/类
@Override
public StringBuilder visitTypeParamType(TypeParamType type, StringBuilder sb) {
    sb.append(type.name);
    String sep = " extends ";
    if (type.classBound != null
            && (options.verbose || !type.classBound.isObject())) {
        sb.append(sep);
        append(sb, type.classBound);
        sep = " & ";
    }
    if (type.interfaceBounds != null) {
        for (Type bound: type.interfaceBounds) {
            sb.append(sep);
            append(sb, bound);
            sep = " & ";
        }
    }
    return sb;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:ClassWriter.java

示例3: append

import com.sun.tools.classfile.Type; //导入依赖的package包/类
private void append(StringBuilder sb, String prefix, List<? extends Type> list, String suffix) {
    sb.append(prefix);
    String sep = "";
    for (Type t: list) {
        sb.append(sep);
        append(sb, t);
        sep = ", ";
    }
    sb.append(suffix);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:ClassWriter.java

示例4: print

import com.sun.tools.classfile.Type; //导入依赖的package包/类
String print(Type t) {
    return t.accept(this, new StringBuilder()).toString();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:ClassWriter.java

示例5: appendIfNotEmpty

import com.sun.tools.classfile.Type; //导入依赖的package包/类
private void appendIfNotEmpty(StringBuilder sb, String prefix, List<? extends Type> list, String suffix) {
    if (!isEmpty(list))
        append(sb, prefix, list, suffix);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:ClassWriter.java

示例6: isEmpty

import com.sun.tools.classfile.Type; //导入依赖的package包/类
private boolean isEmpty(List<? extends Type> list) {
    return (list == null || list.isEmpty());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:ClassWriter.java

示例7: writeField

import com.sun.tools.classfile.Type; //导入依赖的package包/类
protected void writeField(Field f) {
    if (!options.checkAccess(f.access_flags))
        return;

    AccessFlags flags = f.access_flags;
    writeModifiers(flags.getFieldModifiers());
    Signature_attribute sigAttr = getSignature(f.attributes);
    if (sigAttr == null)
        print(getJavaFieldType(f.descriptor));
    else {
        try {
            Type t = sigAttr.getParsedSignature().getType(constant_pool);
            print(getJavaName(t.toString()));
        } catch (ConstantPoolException e) {
            // report error?
            // fall back on non-generic descriptor
            print(getJavaFieldType(f.descriptor));
        }
    }
    print(" ");
    print(getFieldName(f));
    if (options.showConstants) {
        Attribute a = f.attributes.get(Attribute.ConstantValue);
        if (a instanceof ConstantValue_attribute) {
            print(" = ");
            ConstantValue_attribute cv = (ConstantValue_attribute) a;
            print(getConstantValue(f.descriptor, cv.constantvalue_index));
        }
    }
    print(";");
    println();

    indent(+1);

    boolean showBlank = false;

    if (options.showDescriptors)
        println("descriptor: " + getValue(f.descriptor));

    if (options.verbose)
        writeList("flags: ", flags.getFieldFlags(), "\n");

    if (options.showAllAttrs) {
        for (Attribute attr: f.attributes)
            attrWriter.write(f, attr, constant_pool);
        showBlank = true;
    }

    indent(-1);

    if (showBlank || options.showDisassembled || options.showLineAndLocalVariableTables)
        println();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:54,代码来源:ClassWriter.java

示例8: writeField

import com.sun.tools.classfile.Type; //导入依赖的package包/类
protected void writeField(Field f) {
    if (!options.checkAccess(f.access_flags))
        return;

    AccessFlags flags = f.access_flags;
    writeModifiers(flags.getFieldModifiers());
    Signature_attribute sigAttr = getSignature(f.attributes);
    if (sigAttr == null)
        print(getJavaFieldType(f.descriptor));
    else {
        try {
            Type t = sigAttr.getParsedSignature().getType(constant_pool);
            print(getJavaName(t.toString()));
        } catch (ConstantPoolException e) {
            // report error?
            // fall back on non-generic descriptor
            print(getJavaFieldType(f.descriptor));
        }
    }
    print(" ");
    print(getFieldName(f));
    if (options.showConstants) {
        Attribute a = f.attributes.get(Attribute.ConstantValue);
        if (a instanceof ConstantValue_attribute) {
            print(" = ");
            ConstantValue_attribute cv = (ConstantValue_attribute) a;
            print(getConstantValue(f.descriptor, cv.constantvalue_index));
        }
    }
    print(";");
    println();

    indent(+1);

    boolean showBlank = false;

    if (options.showDescriptors)
        println("descriptor: " + getValue(f.descriptor));

    if (options.verbose)
        writeList(String.format("flags: (0x%04x) ", flags.flags), flags.getFieldFlags(), "\n");

    if (options.showAllAttrs) {
        for (Attribute attr: f.attributes)
            attrWriter.write(f, attr, constant_pool);
        showBlank = true;
    }

    indent(-1);

    if (showBlank || options.showDisassembled || options.showLineAndLocalVariableTables)
        println();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:54,代码来源:ClassWriter.java


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