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


Java Identifier类代码示例

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


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

示例1: isSpecial

import sun.tools.java.Identifier; //导入依赖的package包/类
private static boolean isSpecial(sun.tools.java.Type type,
                                 ClassDefinition theClass,
                                 ContextStack stack) {
    if (type.isType(TC_CLASS)) {
        Identifier id = type.getClassName();

        if (id.equals(idRemote)) return true;
        if (id == idJavaIoSerializable) return true;
        if (id == idJavaIoExternalizable) return true;
        if (id == idCorbaObject) return true;
        if (id == idIDLEntity) return true;
        BatchEnvironment env = stack.getEnv();
        try {
            if (env.defCorbaObject.implementedBy(env,theClass.getClassDeclaration())) return true;
        } catch (ClassNotFound e) {
            classNotFound(stack,e);
        }
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:SpecialInterfaceType.java

示例2: setNames

import sun.tools.java.Identifier; //导入依赖的package包/类
/**
 * Set name and package. May only be called during initialization.
 */
protected void setNames(Identifier id, String[] idlModuleNames, String idlName) {

    this.id = id;
    name = Names.mangleClass(id).getName().toString();
    packageName = null;

    if (id.isQualified()) {
        packageName = id.getQualifier().toString();
        qualifiedName = packageName + NAME_SEPARATOR + name;
    } else {
        qualifiedName = name;
    }

    setIDLNames(idlModuleNames,idlName);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:Type.java

示例3: write_tie_thisObject_method

import sun.tools.java.Identifier; //导入依赖的package包/类
public void write_tie_thisObject_method(IndentingWriter p,
                                        Identifier idCorbaObject)
    throws IOException
{
    if(POATie){
        p.plnI("public " + idCorbaObject + " thisObject() {");
        /*
        p.pln("org.omg.CORBA.Object objref = null;");
        p.pln("try{");
        p.pln("objref = _poa().servant_to_reference(this);");
        p.pln("}catch (org.omg.PortableServer.POAPackage.WrongPolicy exception){");
        catchWrongPolicy(p);
        p.pln("}catch (org.omg.PortableServer.POAPackage.ServantNotActive exception){");
        catchServantNotActive(p);
        p.pln("}");
        p.pln("return objref;");
        */
        p.pln("return _this_object();");
        p.pOln("}");
    } else {
        p.plnI("public " + idCorbaObject + " thisObject() {");
        p.pln("return this;");
        p.pOln("}");
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:StubGenerator.java

示例4: PrimitiveType

import sun.tools.java.Identifier; //导入依赖的package包/类
/**
 * IDL_Naming
 * Create an PrimitiveType instance for the given class.
 */
private PrimitiveType(ContextStack stack, int typeCode) {
    super(stack,typeCode | TM_PRIMITIVE);

    // Validate type and set names...

    String idlName = IDLNames.getTypeName(typeCode,false);
    Identifier id = null;

    switch (typeCode) {
    case TYPE_VOID:         id = idVoid; break;
    case TYPE_BOOLEAN:      id = idBoolean; break;
    case TYPE_BYTE:         id = idByte; break;
    case TYPE_CHAR:         id = idChar; break;
    case TYPE_SHORT:        id = idShort; break;
    case TYPE_INT:          id = idInt; break;
    case TYPE_LONG:         id = idLong; break;
    case TYPE_FLOAT:        id = idFloat; break;
    case TYPE_DOUBLE:       id = idDouble; break;
    default:            throw new CompilerError("Not a primitive type");
    }

    setNames(id,null,idlName);
    setRepositoryID();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:PrimitiveType.java

示例5: mangleClass

import sun.tools.java.Identifier; //导入依赖的package包/类
/**
 * If necessary, convert a class name to its mangled form, i.e. the
 * non-inner class name used in the binary representation of
 * inner classes.  This is necessary to be able to name inner
 * classes in the generated source code in places where the language
 * does not permit it, such as when synthetically defining an inner
 * class outside of its outer class, and for generating file names
 * corresponding to inner classes.
 *
 * Currently this mangling involves modifying the internal names of
 * inner classes by converting occurrences of ". " into "$".
 *
 * This code is taken from the "mangleInnerType" method of
 * the "sun.tools.java.Type" class; this method cannot be accessed
 * itself because it is package protected.
 */
static final public Identifier mangleClass(Identifier className) {
    if (!className.isInner())
        return className;

    /*
     * Get '.' qualified inner class name (with outer class
     * qualification and no package qualification) and replace
     * each '.' with '$'.
     */
    Identifier mangled = Identifier.lookup(
                                           className.getFlatName().toString()
                                           .replace('.', sun.tools.java.Constants.SIGC_INNERCLASS));
    if (mangled.isInner())
        throw new Error("failed to mangle inner class name");

    // prepend package qualifier back for returned identifier
    return Identifier.lookup(className.getQualifier(), mangled);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:35,代码来源:Names.java


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