![JAR search and dependency download from the Maven repository](/logo.png)
org.joo.libra.text.IsEmptyPredicate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of joo-libra Show documentation
Show all versions of joo-libra Show documentation
Java Predicate with SQL-like syntax support
package org.joo.libra.text;
import java.util.Collection;
import org.joo.libra.PredicateContext;
import org.joo.libra.common.CompositionPredicate;
import org.joo.libra.common.HasValue;
public class IsEmptyPredicate extends CompositionPredicate {
private HasValue> value;
public IsEmptyPredicate(HasValue> value) {
this.value = value;
}
@SuppressWarnings("rawtypes")
@Override
public boolean satisfiedBy(PredicateContext context) {
Object rawValue = value.getValue(context);
if (rawValue == null) return true;
if (rawValue instanceof String) {
return rawValue.toString().isEmpty();
}
if (rawValue instanceof Collection) {
return ((Collection)rawValue).isEmpty();
}
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy