use of com.cubrid.cubridmanager.core.shard.model.Column in project cubrid-manager by CUBRID.
the class GetShardStatusTask method setFieldValueNew.
private static void setFieldValueNew(TreeNode node, final ShardsStatus shardsStatus) {
if (node == null || shardsStatus == null) {
return;
}
if (node.getChildren() == null || node.getChildren().isEmpty()) {
return;
}
for (TreeNode shard : node.getChildren()) {
ShardStatus shardStatus = new ShardStatus();
Class<?> clazz = shardStatus.getClass();
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
Column column = field.getAnnotation(Column.class);
if (column == null || !column.enable()) {
continue;
}
String propertyName = column.name();
String value = shard.getValue(propertyName);
field.setAccessible(true);
try {
field.set(shardStatus, field.getType().cast(value));
} catch (IllegalArgumentException e) {
LOGGER.error(e.getMessage(), e);
} catch (IllegalAccessException e) {
LOGGER.error(e.getMessage(), e);
}
}
shardsStatus.addShardStatus(shardStatus);
}
}
Aggregations