com.landawn.abacus.condition.Junction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of abacus-util-se Show documentation
Show all versions of abacus-util-se Show documentation
A general programming library in Java/Android. It's easy to learn and simple to use with concise and powerful APIs.
/*
* Copyright (C) 2015 HaiYang Li
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package com.landawn.abacus.condition;
import static com.landawn.abacus.util.WD._PARENTHESES_L;
import static com.landawn.abacus.util.WD._PARENTHESES_R;
import static com.landawn.abacus.util.WD._SPACE;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import com.landawn.abacus.util.N;
import com.landawn.abacus.util.NamingPolicy;
import com.landawn.abacus.util.Objectory;
// TODO: Auto-generated Javadoc
/**
* This class is used to join multiple conditions. like {@code And}, {@code Or}. But must not put clause(where, order by
* ...) into it. Those clauses are joined by {@code Criteria}.
*
* @author Haiyang Li
* @see com.landawn.abacus.condition.Criteria
* @since 0.8
*/
public class Junction extends AbstractCondition {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = -5520467185002717755L;
/** The condition list. */
private List conditionList;
/**
* Instantiates a new junction.
*/
// For Kryo
Junction() {
}
/**
* Instantiates a new junction.
*
* @param operator
* @param conditions
*/
@SafeVarargs
public Junction(Operator operator, Condition... conditions) {
super(operator);
conditionList = new ArrayList<>();
add(conditions);
}
/**
* Instantiates a new junction.
*
* @param operator
* @param conditions
*/
public Junction(Operator operator, Collection extends Condition> conditions) {
super(operator);
conditionList = new ArrayList<>();
add(conditions);
}
/**
* Gets the conditions.
*
* @return
*/
public List getConditions() {
return conditionList;
}
/**
*
* @param conditions
*/
@SafeVarargs
public final void set(Condition... conditions) {
conditionList.clear();
add(conditions);
}
/**
*
* @param conditions
*/
public void set(Collection extends Condition> conditions) {
conditionList.clear();
add(conditions);
}
/**
*
* @param conditions
*/
@SafeVarargs
public final void add(Condition... conditions) {
for (Condition cond : conditions) {
conditionList.add(cond);
}
}
/**
*
* @param conditions
*/
public void add(Collection extends Condition> conditions) {
conditionList.addAll(conditions);
}
/**
*
* @param conditions
*/
@SafeVarargs
public final void remove(Condition... conditions) {
for (Condition cond : conditions) {
conditionList.remove(cond);
}
}
/**
*
* @param conditions
*/
public void remove(Collection extends Condition> conditions) {
conditionList.removeAll(conditions);
}
/**
* Clear.
*/
public void clear() {
conditionList.clear();
}
/**
* Gets the parameters.
*
* @return
*/
@Override
public List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy