All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.neoremind.fountain.StringNotNullClosurePredicate Maven / Gradle / Ivy

package net.neoremind.fountain;

import org.apache.commons.lang3.StringUtils;

/**
 * 字符串是否为空的条件验证
 *
 * @author zhangxu
 */
class StringNotNullClosurePredicate extends AbstractClosurePredicate implements ClosurePredicate {

    public StringNotNullClosurePredicate() {
    }

    public StringNotNullClosurePredicate(String t) {
        super(t);
    }

    /**
     * 静态构造方法
     *
     * @param t   待验证对象
     * @param  对象的类型
     *
     * @return 字符串是否为空的条件验证
     */
    public static StringNotNullClosurePredicate of(String t) {
        return new StringNotNullClosurePredicate(t);
    }

    @Override
    public boolean doApply() {
        return StringUtils.isNotEmpty(t);
    }

    @Override
    public boolean canApply() {
        return t instanceof String;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy