use of org.apache.dubbo.config.support.Parameter in project dubbo by alibaba.
the class AbstractConfig method appendAttributes.
@Deprecated
protected static void appendAttributes(Map<String, Object> parameters, Object config, String prefix) {
if (config == null) {
return;
}
Method[] methods = config.getClass().getMethods();
for (Method method : methods) {
try {
Parameter parameter = method.getAnnotation(Parameter.class);
if (parameter == null || !parameter.attribute()) {
continue;
}
String name = method.getName();
if (MethodUtils.isGetter(method)) {
String key;
if (parameter.key().length() > 0) {
key = parameter.key();
} else {
key = calculateAttributeFromGetter(name);
}
Object value = method.invoke(config);
if (value != null) {
if (prefix != null && prefix.length() > 0) {
key = prefix + "." + key;
}
parameters.put(key, value);
}
}
} catch (Exception e) {
throw new IllegalStateException(e.getMessage(), e);
}
}
}