All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.babyfish.jimmer.sql.cache.ParameterMaps Maven / Gradle / Ivy

There is a newer version: 0.9.19
Show newest version
package org.babyfish.jimmer.sql.cache;

import java.util.Collections;
import java.util.SortedMap;
import java.util.TreeMap;

public class ParameterMaps {

    public static  SortedMap of() {
        return Collections.emptySortedMap();
    }

    public static  SortedMap of(String key, Object value) {
        if (value == null) {
            return Collections.emptySortedMap();
        }
        SortedMap map = new TreeMap<>();
        map.put(key, value);
        return map;
    }

    public static  SortedMap of(
            String key1, Object value1, String key2, Object value2
    ) {
        if (value1 == null && value2 == null) {
            return Collections.emptySortedMap();
        }
        SortedMap map = new TreeMap<>();
        if (value1 != null) {
            map.put(key1, value1);
        }
        if (value2 != null) {
            map.put(key2, value2);
        }
        return map;
    }

    public static  SortedMap of(
            String key1, Object value1,
            String key2, Object value2,
            String key3, Object value3
    ) {
        if (value1 == null && value2 == null && value3 == null) {
            return Collections.emptySortedMap();
        }
        SortedMap map = new TreeMap<>();
        if (value1 != null) {
            map.put(key1, value1);
        }
        if (value2 != null) {
            map.put(key2, value2);
        }
        if (value3 != null) {
            map.put(key3, value3);
        }
        return map;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy