net.intelie.pipes.util.ConstantHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pipes-api Show documentation
Show all versions of pipes-api Show documentation
Intelie Pipes' API classes and interfaces
package net.intelie.pipes.util;
import net.intelie.pipes.Expression;
import net.intelie.pipes.Literal;
import net.intelie.pipes.types.Level;
public abstract class ConstantHelper {
public static boolean isConstant(Object obj) {
return Level.CONSTANT.accepts(obj);
}
public static T evaluate(Expression obj) {
return Level.asScalar(obj).eval(null, null);
}
public static Literal simplify(Expression obj) {
return new Literal<>(obj.type(), evaluate(obj));
}
}