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

com.github.rkmk.CustomPredicate Maven / Gradle / Ivy

package com.github.rkmk;

import com.github.rkmk.mapper.FieldHelper;

import java.util.HashMap;
import java.util.Map;
import java.util.function.Predicate;

public class CustomPredicate implements Predicate {

    private final Map whereClause;

    public CustomPredicate(Map whereClause) {

        this.whereClause = whereClause;
    }

    @Override
    public boolean test(T t) {
        Map objectMap = new HashMap<>();
        for (String field : whereClause.keySet()) {
            objectMap.put(field, FieldHelper.accessField(field, t));
        }
        return objectMap.size() == whereClause.size() && objectMap.equals(whereClause);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy