Example usage for org.eclipse.jdt.internal.compiler.env ICompilationUnit getMainTypeName

List of usage examples for org.eclipse.jdt.internal.compiler.env ICompilationUnit getMainTypeName

Introduction

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

Prototype

char[] getMainTypeName();

Source Link

Document

Answer the name of the top level public type.

Usage

From source file:org.conqat.engine.java.ecj.EcjUtils.java

License:Apache License

/**
 * Get the fully qualified main type name of a compilation unit.
 *///from w w w .  j a  v  a  2  s . c o  m
public static String getMainTypeName(ICompilationUnit compilationUnit) {
    String name;

    if (compilationUnit.getPackageName() == null) {
        // default package
        name = StringUtils.EMPTY_STRING;
    } else {
        name = String.valueOf(compilationUnit.getPackageName()) + ".";
    }

    return name + String.valueOf(compilationUnit.getMainTypeName());
}