in core-it-support/core-it-plugins/maven-it-plugin-class-loader/maven-it-plugin-class-loader/src/main/java/org/apache/maven/plugin/coreit/ExpressionUtil.java [141:198]
static Object getProperty(Object context, String property) {
Object value;
Class type = context.getClass();
if (context instanceof Collection) {
type = Collection.class;
} else if (context instanceof Map) {
type = Map.class;
}
try {
try {
Method method = type.getMethod(property, NO_PARAMS);
method.setAccessible(true);
value = method.invoke(context, NO_ARGS);
} catch (NoSuchMethodException e) {
try {
String name = "get" + Character.toUpperCase(property.charAt(0)) + property.substring(1);
Method method = type.getMethod(name, NO_PARAMS);
method.setAccessible(true);
value = method.invoke(context, NO_ARGS);
} catch (NoSuchMethodException e1) {
try {
String name = "is" + Character.toUpperCase(property.charAt(0)) + property.substring(1);
Method method = type.getMethod(name, NO_PARAMS);
method.setAccessible(true);
value = method.invoke(context, NO_ARGS);
} catch (NoSuchMethodException e2) {
try {
Method method;
try {
method = type.getMethod("get", STRING_PARAM);
} catch (NoSuchMethodException e3) {
method = type.getMethod("get", OBJECT_PARAM);
}
method.setAccessible(true);
value = method.invoke(context, new Object[] {property});
} catch (NoSuchMethodException e3) {
try {
Field field = type.getField(property);
field.setAccessible(true);
value = field.get(context);
} catch (NoSuchFieldException e4) {
if ("length".equals(property) && type.isArray()) {
value = Array.getLength(context);
} else {
throw e4;
}
}
}
}
}
}
} catch (Exception e) {
value = null;
}
return value;
}