public static Object loadCallbackType()

in plugins/core/src/main/java/org/apache/cxf/fediz/core/config/ConfigUtils.java [39:69]


    public static Object loadCallbackType(CallbackType cbt, String name, ClassLoader classLoader) {
        if (cbt == null || cbt.getValue() == null) {
            return null;
        }
        if (cbt.getType() == null || cbt.getType().equals(ArgumentType.STRING)) {
            return cbt.getValue();
        } else if (cbt.getType().equals(ArgumentType.CLASS)) {
            final String[] cbtHandler = cbt.getValue().split(",");
            // Backward compatible return handler directly if only one is configured
            final List<Object> handlers = cbtHandler.length == 1 ? null : new ArrayList<>(cbtHandler.length);
            for (String cbh : cbtHandler) {
                try {
                    final Object handler = (classLoader == null
                        ? ClassLoaderUtils.loadClass(cbh, ConfigUtils.class)
                        : classLoader.loadClass(cbh)).getDeclaredConstructor().newInstance();
                    if (handlers != null) {
                        handlers.add(handler);
                    } else {
                        return handler;
                    }
                } catch (Exception e) {
                    LOG.error("Failed to create instance of " + cbh, e);
                    //throw new IllegalStateException("Failed to create instance of " + cbt.getValue());
                }
            }
            return handlers;
        } else {
            LOG.error("Only String and Class are supported for '{}'", name);
            throw new IllegalStateException("Only String and Class are supported for '" + name + "'");
        }
    }