Example usage for org.eclipse.jdt.core.util IMethodInfo isConstructor

List of usage examples for org.eclipse.jdt.core.util IMethodInfo isConstructor

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.util IMethodInfo isConstructor.

Prototype

boolean isConstructor();

Source Link

Document

Answer true if this method info represents a constructor, false otherwise.

Usage

From source file:org.eclipse.ajdt.internal.ui.editor.quickfix.AJSerialVersionHashOperation.java

License:Open Source License

private static IMethodInfo[] getSortedMethods(IClassFileReader cfReader) {
    IMethodInfo[] allMethods = cfReader.getMethodInfos();
    Arrays.sort(allMethods, new Comparator() {
        public int compare(Object o1, Object o2) {
            IMethodInfo mi1 = (IMethodInfo) o1;
            IMethodInfo mi2 = (IMethodInfo) o2;
            if (mi1.isConstructor() != mi2.isConstructor()) {
                return mi1.isConstructor() ? -1 : 1;
            } else if (mi1.isConstructor()) {
                return 0;
            }/* w w w .j  a va2s  .co m*/
            int res = CharOperation.compareTo(mi1.getName(), mi2.getName());
            if (res != 0) {
                return res;
            }
            return CharOperation.compareTo(mi1.getDescriptor(), mi2.getDescriptor());
        }
    });
    return allMethods;
}