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

Method encode

form/src/main/java/feign/form/FormEncoder.java:80–103  ·  view source on GitHub ↗
(Object object, Type bodyType, RequestTemplate template)

Source from the content-addressed store, hash-verified

78 }
79
80 @Override
81 @SuppressWarnings("unchecked")
82 public void encode(Object object, Type bodyType, RequestTemplate template)
83 throws EncodeException {
84 String contentTypeValue = getContentTypeValue(template.headers());
85 val contentType = ContentType.of(contentTypeValue);
86 if (processors.containsKey(contentType) == false) {
87 delegate.encode(object, bodyType, template);
88 return;
89 }
90
91 Map<String, Object> data;
92 if (object instanceof Map) {
93 data = (Map<String, Object>) object;
94 } else if (isUserPojo(bodyType)) {
95 data = toMap(object);
96 } else {
97 delegate.encode(object, bodyType, template);
98 return;
99 }
100
101 val charset = getCharset(contentTypeValue);
102 processors.get(contentType).process(template, charset, data);
103 }
104
105 /**
106 * Returns {@link ContentProcessor} for specific {@link ContentType}.

Callers

nothing calls this directly

Calls 10

getContentTypeValueMethod · 0.95
ofMethod · 0.95
getCharsetMethod · 0.95
containsKeyMethod · 0.80
headersMethod · 0.65
encodeMethod · 0.65
processMethod · 0.65
getMethod · 0.65
isUserPojoMethod · 0.45
toMapMethod · 0.45

Tested by

no test coverage detected