FileDocCategorySizeDatePackage
EmptyOperator.javaAPI DocGlassfish v2 API4137Sat May 05 19:17:26 BST 2007org.apache.taglibs.standard.lang.jstl

EmptyOperator

public class EmptyOperator extends UnaryOperator

The implementation of the empty operator

author
Nathan Abramson - Art Technology Group
version
$Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: tcfujii $

Fields Summary
public static final EmptyOperator
SINGLETON
Constructors Summary
public EmptyOperator()
Constructor


  //-------------------------------------
      
    
  
  
Methods Summary
public java.lang.Objectapply(java.lang.Object pValue, java.lang.Object pContext, Logger pLogger)
Applies the operator to the given value

    // See if the value is null
    if (pValue == null) {
      return PrimitiveObjects.getBoolean (true);
    }

    // See if the value is a zero-length String
    else if ("".equals (pValue)) {
      return PrimitiveObjects.getBoolean (true);
    }

    // See if the value is a zero-length array
    else if (pValue.getClass ().isArray () &&
	     Array.getLength (pValue) == 0) {
      return PrimitiveObjects.getBoolean (true);
    }

    // See if the value is an empty List
    else if (pValue instanceof List &&
	     ((List) pValue).isEmpty ()) {
      return PrimitiveObjects.getBoolean (true);
    }

    // See if the value is an empty Map
    else if (pValue instanceof Map &&
	     ((Map) pValue).isEmpty ()) {
      return PrimitiveObjects.getBoolean (true);
    }

    // Otherwise, not empty
    else {
      return PrimitiveObjects.getBoolean (false);
    }
  
public java.lang.StringgetOperatorSymbol()
Returns the symbol representing the operator

    return "empty";