// TODO Want to use classLoader = mgmt.getCatalog().getRootClassLoader();
@Override public brooklyn.management.internal.UsageListener apply(String input) {
                // TODO Want to use classLoader = mgmt.getCatalog().getRootClassLoader();
                ClassLoader classLoader = LocalUsageManager.class.getClassLoader();
                Optional<Object> result = Reflections.invokeConstructorWithArgs(classLoader, input);
                if (result.isPresent()) {
                    if (result.get() instanceof brooklyn.management.internal.UsageManager.UsageListener) {
                        return new brooklyn.management.internal.UsageManager.UsageListener.UsageListenerAdapter((brooklyn.management.internal.UsageManager.UsageListener) result.get());
                    } else {
                        return (brooklyn.management.internal.UsageListener) result.get();
                    }
                } else {
                    throw new IllegalStateException("Failed to create UsageListener from class name '"+input+"' using no-arg constructor");
                }
            }
@Override public brooklyn.management.internal.UsageListener apply(String input) {
// TODO Want to use classLoader = mgmt.getCatalog().getRootClassLoader();
ClassLoader classLoader = LocalUsageManager.class.getClassLoader();
Optional<Object> result = Reflections.invokeConstructorWithArgs(classLoader, input);
@Override public brooklyn.management.internal.UsageListener apply(String input) {
// TODO Want to use classLoader = mgmt.getCatalog().getRootClassLoader();
ClassLoader classLoader = LocalUsageManager.class.getClassLoader();
Optional<Object> result = Reflections.invokeConstructorWithArgs(classLoader, input);
if (result.isPresent()) {
if (result.get() instanceof brooklyn.management.internal.UsageManager.UsageListener) {
return new brooklyn.management.internal.UsageManager.UsageListener.UsageListenerAdapter((brooklyn.management.internal.UsageManager.UsageListener) result.get());
} else {
return (brooklyn.management.internal.UsageListener) result.get();
}
} else {
throw new IllegalStateException("Failed to create UsageListener from class name '"+input+"' using no-arg constructor");
@Override public brooklyn.management.internal.UsageListener apply(String input) {
// TODO Want to use classLoader = mgmt.getCatalog().getRootClassLoader();
ClassLoader classLoader = LocalUsageManager.class.getClassLoader();
Optional<Object> result = Reflections.invokeConstructorWithArgs(classLoader, input);
if (result.isPresent()) {
if (result.get() instanceof brooklyn.management.internal.UsageManager.UsageListener) {
return new brooklyn.management.internal.UsageManager.UsageListener.UsageListenerAdapter((brooklyn.management.internal.UsageManager.UsageListener) result.get());
} else {
return (brooklyn.management.internal.UsageListener) result.get();
}
} else {
throw new IllegalStateException("Failed to create UsageListener from class name '"+input+"' using no-arg constructor");
}
}