001    package railo.runtime.functions.system;
002    
003    import railo.runtime.PageContext;
004    import railo.runtime.exp.FunctionException;
005    import railo.runtime.ext.function.Function;
006    import railo.runtime.functions.string.Len;
007    import railo.runtime.interpreter.VariableInterpreter;
008    import railo.runtime.op.Caster;
009    
010    public class Empty implements Function {
011    
012            private static final long serialVersionUID = 3780957672985941192L;
013            
014    
015            public static boolean call(PageContext pc , String variableName) throws FunctionException {
016                    Object res = VariableInterpreter.getVariableEL(pc, variableName,null);
017                    
018                    if(res==null) return true;
019                    double len=Len.invoke(res, -1);
020                    if(len==-1)throw new FunctionException(pc,"empty",1,"variable","this type  ["+Caster.toTypeName(res)+"] is not supported");
021                    return len==0;
022            }
023    }