MCPcopy Index your code
hub / github.com/OpenFeign/feign / toMap

Method toMap

form/src/main/java/feign/form/util/PojoUtil.java:54–78  ·  view source on GitHub ↗
(@NonNull Object object)

Source from the content-addressed store, hash-verified

52 }
53
54 @SneakyThrows
55 public static Map<String, Object> toMap(@NonNull Object object) {
56 val result = new HashMap<String, Object>();
57 val type = object.getClass();
58 for (val field : type.getDeclaredFields()) {
59 val modifiers = field.getModifiers();
60 if (isFinal(modifiers) || isStatic(modifiers)) {
61 continue;
62 }
63 field.setAccessible(true);
64
65 val fieldValue = field.get(object);
66 if (fieldValue == null) {
67 continue;
68 }
69
70 val propertyKey =
71 field.isAnnotationPresent(FormProperty.class)
72 ? field.getAnnotation(FormProperty.class).value()
73 : field.getName();
74
75 result.put(propertyKey, fieldValue);
76 }
77 return result;
78 }
79
80 private PojoUtil() throws UnexpectedException {
81 throw new UnexpectedException("It is not allowed to instantiate this class");

Callers 8

processMethod · 0.45
encodeMethod · 0.45
writeMethod · 0.45
getFeignMetricsMethod · 0.45

Calls 3

getMethod · 0.65
putMethod · 0.65
getNameMethod · 0.45