Example usage for org.apache.commons.collections.bag HashBag getClass

List of usage examples for org.apache.commons.collections.bag HashBag getClass

Introduction

In this page you can find the example usage for org.apache.commons.collections.bag HashBag getClass.

Prototype

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

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:org.jboss.as.test.integration.osgi.ear.CollectionsServlet.java

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    HashBag bag = new HashBag();
    ModuleClassLoader classLoader = (ModuleClassLoader) bag.getClass().getClassLoader();
    String source = classLoader.getModule().getIdentifier().toString();
    if (classLoader instanceof BundleReference) {
        source = ((BundleReference) classLoader).getBundle().toString();
    }/*from w  w w  . j  a v a 2  s . c  o  m*/
    Writer writer = resp.getWriter();
    writer.write(HashBag.class.getSimpleName() + " loaded from " + source);
}