Skip to content

Commit

Permalink
feat: 添加class进map转换
Browse files Browse the repository at this point in the history
  • Loading branch information
livk-cloud committed Jul 4, 2024
1 parent 3c6df1b commit 391abed
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import java.beans.PropertyDescriptor;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -102,13 +103,11 @@ public static Map<String, Object> convert(Object source) {
PropertyDescriptor[] descriptors = beanWrapper.getPropertyDescriptors();
Map<String, Object> map = new HashMap<>();
for (PropertyDescriptor descriptor : descriptors) {
if ("class".equals(descriptor.getName())) {
continue;
}
Object propertyValue = beanWrapper.getPropertyValue(descriptor.getName());
map.put(descriptor.getName(), propertyValue);
String name = descriptor.getName();
Object propertyValue = beanWrapper.getPropertyValue(name);
map.put(name, propertyValue);
}
return map;
return Collections.unmodifiableMap(map);
}

}

0 comments on commit 391abed

Please sign in to comment.