|
| 1 | +/** |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + * |
| 19 | +* @Title: Filters.java |
| 20 | +* @Package openthinks.libs.sql.dhibernate.support.query |
| 21 | +* @Description: TODO |
| 22 | +* @author dailey.yet@outlook.com |
| 23 | +* @date 2015-7-30 |
| 24 | +* @version V1.0 |
| 25 | +*/ |
| 26 | +package openthinks.libs.sql.dhibernate.support.query; |
| 27 | + |
| 28 | +import openthinks.libs.sql.dhibernate.support.query.impl.AbstractQueryFilter; |
| 29 | +import openthinks.libs.sql.dhibernate.support.query.impl.ContainerFilter; |
| 30 | +import openthinks.libs.sql.dhibernate.support.query.impl.EqualsFilter; |
| 31 | +import openthinks.libs.sql.dhibernate.support.query.impl.NotEqualsFilter; |
| 32 | +import openthinks.libs.sql.dhibernate.support.query.impl.QueryFilterConnects; |
| 33 | +import openthinks.libs.sql.dhibernate.support.query.impl.QueryFilterGroup; |
| 34 | + |
| 35 | +/** |
| 36 | + * The helper for implemented {@link QueryFilter} |
| 37 | + * @author dailey.yet@outlook.com |
| 38 | + * |
| 39 | + */ |
| 40 | +public final class Filters { |
| 41 | + |
| 42 | + public static AbstractQueryFilter<EqualsFilter> eq(Object value) { |
| 43 | + return new EqualsFilter().eq(value); |
| 44 | + } |
| 45 | + |
| 46 | + public static AbstractQueryFilter<NotEqualsFilter> neq(Object value) { |
| 47 | + return new NotEqualsFilter().neq(value); |
| 48 | + } |
| 49 | + |
| 50 | + public static AbstractQueryFilter<ContainerFilter> include(Object value) { |
| 51 | + return new ContainerFilter().include(value); |
| 52 | + } |
| 53 | + |
| 54 | + public static AbstractQueryFilter<EqualsFilter> eq(String attributeName, Object value) { |
| 55 | + return new EqualsFilter(null, attributeName).eq(value); |
| 56 | + } |
| 57 | + |
| 58 | + public static AbstractQueryFilter<NotEqualsFilter> neq(String attributeName, Object value) { |
| 59 | + return new NotEqualsFilter(null, attributeName).neq(value); |
| 60 | + } |
| 61 | + |
| 62 | + public static AbstractQueryFilter<ContainerFilter> include(String attributeName, Object value) { |
| 63 | + return new ContainerFilter(null, attributeName).include(value); |
| 64 | + } |
| 65 | + |
| 66 | + public static QueryFilterConnect or() { |
| 67 | + return QueryFilterConnects.or(); |
| 68 | + } |
| 69 | + |
| 70 | + public static QueryFilterConnect and() { |
| 71 | + return QueryFilterConnects.and(); |
| 72 | + } |
| 73 | + |
| 74 | + public static QueryFilterGroup group() { |
| 75 | + return new QueryFilterGroup(); |
| 76 | + } |
| 77 | +} |
0 commit comments