in activemq-protobuf/src/main/java/org/apache/activemq/protobuf/compiler/IntrospectionSupport.java [47:93]
public static boolean getProperties(Object target, Map props, String optionPrefix) {
boolean rc = false;
if (target == null) {
throw new IllegalArgumentException("target was null.");
}
if (props == null) {
throw new IllegalArgumentException("props was null.");
}
if (optionPrefix == null) {
optionPrefix = "";
}
Class clazz = target.getClass();
Method[] methods = clazz.getMethods();
for (int i = 0; i < methods.length; i++) {
Method method = methods[i];
String name = method.getName();
Class type = method.getReturnType();
Class params[] = method.getParameterTypes();
if (name.startsWith("get") && params.length == 0 && type != null && isSettableType(type)) {
try {
Object value = method.invoke(target, new Object[] {});
if (value == null) {
continue;
}
String strValue = convertToString(value, type);
if (strValue == null) {
continue;
}
name = name.substring(3, 4).toLowerCase() + name.substring(4);
props.put(optionPrefix + name, strValue);
rc = true;
} catch (Throwable ignore) {
}
}
}
return rc;
}