Skip to content

Instantly share code, notes, and snippets.

@emersonmoura
emersonmoura / JpaGenericFilter.java
Last active September 9, 2018 22:38
Search field Predicate creator
//############### This is a generic filter to use with Spring data framework.
//############### It possibilities only one abstraction to any user filter in your system
public class Filter<T> implements Specification<T> {
private static final Logger LOGGER = LoggerFactory.getLogger(Filter.class);
private Class<?> searchableType;
private Object fields;
private CriteriaBuilder cb;
private Root<T> root;
class PoolInformation
attr_reader :dataSource
def initialize(informations = {})
@config = ConfigReader.new
define_attr informations
end
def label
@dataSource.upcase