Example usage for org.eclipse.jdt.internal.compiler.env IBinaryNestedType getName

List of usage examples for org.eclipse.jdt.internal.compiler.env IBinaryNestedType getName

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.env IBinaryNestedType getName.

Prototype


char[] getName();

Source Link

Document

Answer the resolved name of the member type in the class file format as specified in section 4.2 of the Java 2 VM spec.

Usage

From source file:com.codenvy.ide.ext.java.server.internal.core.ClassFileInfo.java

License:Open Source License

/**
 * Creates the handles for the inner types of the given binary type.
 * Adds new handles to the given vector.
 *///from www. j  a va2 s  .  co  m
private void generateInnerClassHandles(IType type, IBinaryType typeInfo, ArrayList childrenHandles) {
    // Add inner types
    // If the current type is an inner type, innerClasses returns
    // an extra entry for the current type.  This entry must be removed.
    // Can also return an entry for the enclosing type of an inner type.
    IBinaryNestedType[] innerTypes = typeInfo.getMemberTypes();
    if (innerTypes != null) {
        IPackageFragment pkg = (IPackageFragment) type.getAncestor(IJavaElement.PACKAGE_FRAGMENT);
        for (int i = 0, typeCount = innerTypes.length; i < typeCount; i++) {
            IBinaryNestedType binaryType = innerTypes[i];
            IClassFile parentClassFile = pkg.getClassFile(
                    new String(ClassFile.unqualifiedName(binaryType.getName())) + SUFFIX_STRING_class);
            IType innerType = new BinaryType((JavaElement) parentClassFile,
                    ((JavaElement) parentClassFile).manager, ClassFile.simpleName(binaryType.getName()));
            childrenHandles.add(innerType);
        }
    }
}

From source file:org.eclipse.che.jdt.BinaryTypeConvector.java

License:Open Source License

private static JsonElement toJsonMemberType(IBinaryNestedType type) {
    JsonObject object = new JsonObject();
    object.add("enclosingTypeName", type.getEnclosingTypeName() == null ? JsonNull.INSTANCE
            : new JsonPrimitive(new String(type.getEnclosingTypeName())));
    object.addProperty("modifiers", type.getModifiers());
    object.add("name",
            type.getName() == null ? JsonNull.INSTANCE : new JsonPrimitive(new String(type.getName())));
    return object;
}