(Object object, Type bodyType, RequestTemplate template)
| 23 | public class DefaultEncoder implements Encoder { |
| 24 | |
| 25 | @Override |
| 26 | public void encode(Object object, Type bodyType, RequestTemplate template) { |
| 27 | if (bodyType == String.class) { |
| 28 | template.body(object.toString()); |
| 29 | } else if (bodyType == byte[].class) { |
| 30 | template.body((byte[]) object, null); |
| 31 | } else if (object != null) { |
| 32 | throw new EncodeException( |
| 33 | format("%s is not a type supported by this encoder.", object.getClass())); |
| 34 | } |
| 35 | } |
| 36 | } |