package com.eactive.eai.transformer.function.validate;

import java.util.Stack;

import org.apache.commons.lang3.StringUtils;
import org.nfunk.jep.ParseException;
import org.nfunk.jep.function.PostfixMathCommand;

public class isBlank extends PostfixMathCommand {

	public isBlank() {
		numberOfParameters = 1;
	}

	public void run(Stack inStack) throws ParseException {

		checkStack(inStack);

		Object p1 = inStack.pop();

		if (p1 instanceof String) {
			String str1 = (String) p1;

			inStack.push(StringUtils.isBlank(str1));

		} else {
			throw new ParseException("Invalid parameter type, p1 is not string");
		}
	}

}
