com.bazaarvoice.emodb.sor.condition.Conditions Maven / Gradle / Ivy
The newest version!
package com.bazaarvoice.emodb.sor.condition;
import com.bazaarvoice.emodb.sor.condition.impl.AndConditionBuilderImpl;
import com.bazaarvoice.emodb.sor.condition.impl.ComparisonConditionImpl;
import com.bazaarvoice.emodb.sor.condition.impl.ConstantConditionImpl;
import com.bazaarvoice.emodb.sor.condition.impl.EqualConditionImpl;
import com.bazaarvoice.emodb.sor.condition.impl.InConditionImpl;
import com.bazaarvoice.emodb.sor.condition.impl.IntrinsicConditionImpl;
import com.bazaarvoice.emodb.sor.condition.impl.IsConditionImpl;
import com.bazaarvoice.emodb.sor.condition.impl.LikeConditionImpl;
import com.bazaarvoice.emodb.sor.condition.impl.MapConditionBuilderImpl;
import com.bazaarvoice.emodb.sor.condition.impl.NotConditionImpl;
import com.bazaarvoice.emodb.sor.condition.impl.OrConditionBuilderImpl;
import com.bazaarvoice.emodb.sor.condition.impl.PartitionConditionImpl;
import com.bazaarvoice.emodb.sor.delta.deser.DeltaParser;
import com.bazaarvoice.emodb.sor.delta.impl.ContainsConditionImpl;
import com.google.common.collect.Sets;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Set;
public abstract class Conditions {
public static Condition fromString(String string) {
return DeltaParser.parseCondition(string);
}
public static Condition always(boolean value) {
return value ? alwaysTrue() : alwaysFalse();
}
public static Condition alwaysFalse() {
return ConstantConditionImpl.FALSE;
}
public static Condition alwaysTrue() {
return ConstantConditionImpl.TRUE;
}
public static Condition equal(@Nullable Object json) {
return new EqualConditionImpl(json);
}
public static Condition in(Object... json) {
return in(Arrays.asList(json));
}
public static Condition in(Collection> json) {
if (json.isEmpty()) {
return alwaysFalse();
} else if (json.size() == 1) {
return equal(json.iterator().next());
}
Set
© 2015 - 2025 Weber Informatics LLC | Privacy Policy