private static Object getMappedValue()

in src/main/java/org/apache/maven/shared/utils/introspection/ReflectionValueExtractor.java [224:252]


    private static Object getMappedValue(
            final String expression, final int from, final int to, final Object value, final String key)
            throws IntrospectionException {
        if (value == null || key == null) {
            return null;
        }

        if (value instanceof Map) {
            Object[] localParams = new Object[] {key};
            ClassMap classMap = getClassMap(value.getClass());
            try {
                Method method = classMap.findMethod("get", localParams);
                return method.invoke(value, localParams);
            } catch (AmbiguousException e) {
                throw new IntrospectionException(e);
            } catch (IllegalAccessException e) {
                throw new IntrospectionException(e);
            } catch (InvocationTargetException e) {
                throw new IntrospectionException(e.getTargetException());
            }
        }

        final String message = String.format(
                "The token '%s' at position '%d' refers to a java.util.Map, but the value "
                        + "seems is an instance of '%s'",
                expression.subSequence(from, to), from, value.getClass());

        throw new IntrospectionException(message);
    }