org.nutz.el.opt.logic.OrOpt2 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nutz Show documentation
Show all versions of nutz Show documentation
Nutz, which is a collections of lightweight frameworks, each of them can be used independently
package org.nutz.el.opt.logic;
import org.nutz.el.opt.TwoTernary;
import org.nutz.lang.Lang;
/**
* A ||| B 如果A是null, 或者A是数组/集合/Map但长度是0,返回B
*
* @author wendal([email protected])
*
*/
public class OrOpt2 extends TwoTernary {
public int fetchPriority() {
return 12;
}
public Object calculate() {
Object lval = calculateItem(left);
if (Lang.eleSize(lval) > 0) {
return lval;
}
return calculateItem(right);
}
public String fetchSelf() {
return "|||";
}
}