protected Object getBeanProperty()

in src/it/setup-custom-toolchain/src/main/java/org/apache/maven/plugins/toolchains/its/custom/CustomToolchainFactory.java [137:155]


    protected Object getBeanProperty(Object obj, String property) {
        try {
            Method method = new PropertyDescriptor(property, obj.getClass()).getReadMethod();

            return method.invoke(obj);
        } catch (IntrospectionException e) {
            throw new RuntimeException("Incompatible toolchain API", e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException("Incompatible toolchain API", e);
        } catch (InvocationTargetException e) {
            Throwable cause = e.getCause();

            if (cause instanceof RuntimeException) {
                throw (RuntimeException) cause;
            }

            throw new RuntimeException("Incompatible toolchain API", e);
        }
    }