Example usage for java.lang StringBuilder getClass

List of usage examples for java.lang StringBuilder getClass

Introduction

In this page you can find the example usage for java.lang StringBuilder getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:com.quinsoft.zeidon.standardoe.JavaObjectEngine.java

/**
 * @param logger/*from   w  w  w.j a v  a  2 s  .c o  m*/
 */
private static String getClassPath(ZeidonLogger logger) {
    try {
        StringBuilder classpath = new StringBuilder();
        ClassLoader classLoader = classpath.getClass().getClassLoader();
        if (classLoader == null)
            classLoader = ClassLoader.getSystemClassLoader();

        URL[] urls = ((URLClassLoader) classLoader).getURLs();
        for (URL url : urls)
            classpath.append(url.getFile()).append("\n");

        return classpath.toString();
    } catch (Exception e) {
        if (logger != null)
            logger.error("Error trying to log classpath", e, (Object[]) null);

        return "<Error retrieving classpath>";
    }
}