library/src/main/java/com/github/lykmapipo/retrofit/HttpService.java
public static synchronized Map<String, RequestBody> createBodyParts(@NonNull Map<String, Object> params) {
        // initialize part map for request body
        HashMap<String, RequestBody> bodyParts = new HashMap<String, RequestBody>();
        // collect request body parts
        if (!params.isEmpty()) {
            for (String key : params.keySet()) {
                Object value = params.get(key);
                boolean isAllowedPart =
                        !TextUtils.isEmpty(key) && value != null && !(value instanceof File);
                if (isAllowedPart) {
                    RequestBody part = createBodyPart(String.valueOf(value));
                    bodyParts.put(key, part);
                }
            }
        }
        // return part map request body
        return bodyParts;
    }
/**
     * Helper method to convert map of object values to map of request body.
     *
     * @param params {@link Map}
     * @return {@link retrofit2.http.PartMap}
     * @since 0.6.0
     */
Helper method to convert map of object values to map of request body.
Helper method to convert map of object values to map of request body .
public static synchronized Map<String, RequestBody> createBodyParts(@NonNull Map<String, Object> params) {
        HashMap<String, RequestBody> bodyParts = new HashMap<String, RequestBody>();
        if (!params.isEmpty()) {
            for (String key : params.keySet()) {
                Object value = params.get(key);
                boolean isAllowedPart =
                        !TextUtils.isEmpty(key) && value != null && !(value instanceof File);
                if (isAllowedPart) {
                    RequestBody part = createBodyPart(String.valueOf(value));
                    bodyParts.put(key, part);
                }
            }
        }
        return bodyParts;
    }
public static synchronized Map < String , RequestBody > createBodyParts ( @ NonNull Map < String , Object > params ) { HashMap < String , RequestBody > bodyParts = new HashMap < String , RequestBody > ( ) ; if ( ! params . isEmpty ( ) ) { for ( String key : params . keySet ( ) ) { Object value = params . get ( key ) ; boolean isAllowedPart = ! TextUtils . isEmpty ( key ) && value != null && ! ( value instanceof File ) ; if ( isAllowedPart ) { RequestBody part = createBodyPart ( String . valueOf ( value ) ) ; bodyParts . put ( key , part ) ; } } } return bodyParts ; }
Helper method to convert map of object values to map of request body.
Helper method to convert map of object values to map of request body .
// initialize part map for request body // collect request body parts // return part map request body