(Object object, Type bodyType, RequestTemplate template)
| 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}. |
nothing calls this directly
no test coverage detected