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


Java ElementKind.STATIC_INIT属性代码示例

本文整理汇总了Java中javax.lang.model.element.ElementKind.STATIC_INIT属性的典型用法代码示例。如果您正苦于以下问题:Java ElementKind.STATIC_INIT属性的具体用法?Java ElementKind.STATIC_INIT怎么用?Java ElementKind.STATIC_INIT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.lang.model.element.ElementKind的用法示例。


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

示例1: addMembers

private void addMembers( final TypeElement e, final Description parentDescription, final CompilationInfo info, final Context ctx, boolean fqn) {
    List<? extends Element> members = info.getElements().getAllMembers( e );
    for( Element m : members ) {
        if( canceled.get() )
            return;

        if (m.getKind() == ElementKind.STATIC_INIT) {
            continue;
        }

        Description d = element2description(m, e, parentDescription.isInherited, info, ctx, fqn);
        if( null != d ) {
            if (!parentDescription.subs.add( d )) {
                LOG.log(Level.INFO, "Duplicate enclosed element: {0}", d.name);   //NOI18N  Should never happen
            }
            if( m instanceof TypeElement && !d.isInherited ) {
                addMembers( (TypeElement)m, d, info, ctx, fqn);
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:ElementScanningTask.java

示例2: getGroupId

/**
 * Returns the group number of the class member. Elements with the same
 * number form a group. Groups with lower numbers should be positioned
 * higher in the class member list.
 * @param tree the member tree
 * @return the group number
 * @since 0.96
 */
public int getGroupId(Tree tree) {
    ElementKind kind = ElementKind.OTHER;
    Set<Modifier> modifiers = null;
    switch (tree.getKind()) {
        case ANNOTATION_TYPE:
        case CLASS:
        case ENUM:
        case INTERFACE:
            kind = ElementKind.CLASS;
            modifiers = ((ClassTree)tree).getModifiers().getFlags();
            break;
        case METHOD:
            MethodTree mt = (MethodTree)tree;
            if (mt.getName().contentEquals("<init>")) { //NOI18N
                kind = ElementKind.CONSTRUCTOR;
            } else {
                kind = ElementKind.METHOD;
            }
            modifiers = mt.getModifiers().getFlags();
            break;
        case VARIABLE:
            kind = ElementKind.FIELD;
            modifiers = ((VariableTree)tree).getModifiers().getFlags();
            break;
        case BLOCK:
            kind = ((BlockTree)tree).isStatic() ? ElementKind.STATIC_INIT : ElementKind.INSTANCE_INIT;
            break;
    }
    for (Info info : infos) {
        if (info.check(kind, modifiers))
            return info.groupId;
    }
    return infos.length;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:42,代码来源:CodeStyle.java

示例3: getIconName

private static String getIconName( ElementKind kind, String typeName, String extension, Collection<Modifier> modifiers ) {
    
    StringBuffer fileName = new StringBuffer( typeName );
    
    if ( modifiers.contains( Modifier.STATIC ) ) {
        fileName.append( "Static" );                        //NOI18N
    }
    if ( modifiers.contains( Modifier.ABSTRACT ) ) {
        fileName.append( "Abstract" );                        //NOI18N
    }
    if ( modifiers.contains( Modifier.DEFAULT ) ) {
        fileName.append( "Default" );                        //NOI18N
    }
    if (kind == ElementKind.STATIC_INIT || kind == ElementKind.INSTANCE_INIT) {
        return fileName.append(extension).toString();
    }
    if ( modifiers.contains( Modifier.PUBLIC ) ) {
        return fileName.append( "Public" ).append( extension ).toString();      //NOI18N
    }
    if ( modifiers.contains( Modifier.PROTECTED ) ) {
        return fileName.append( "Protected" ).append( extension ).toString();   //NOI18N
    }
    if ( modifiers.contains( Modifier.PRIVATE ) ) {
        return fileName.append( "Private" ).append( extension ).toString();     //NOI18N
    }
    return fileName.append( "Package" ).append( extension ).toString();         //NOI18N
                    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:Icons.java

示例4: getKind

@DefinedBy(Api.LANGUAGE_MODEL)
public ElementKind getKind() {
    if (name == name.table.names.init)
        return ElementKind.CONSTRUCTOR;
    else if (name == name.table.names.clinit)
        return ElementKind.STATIC_INIT;
    else if ((flags() & BLOCK) != 0)
        return isStatic() ? ElementKind.STATIC_INIT : ElementKind.INSTANCE_INIT;
    else
        return ElementKind.METHOD;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:Symbol.java

示例5: isStaticOrInstanceInit

public boolean isStaticOrInstanceInit() {
    return getKind() == ElementKind.STATIC_INIT ||
            getKind() == ElementKind.INSTANCE_INIT;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:Symbol.java


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