org.springframework.rules.closure
Class StringLength

java.lang.Object
  extended by org.springframework.core.closure.support.AlgorithmsAccessor
      extended by org.springframework.core.closure.support.AbstractClosure
          extended by org.springframework.rules.closure.StringLength
All Implemented Interfaces:
Serializable, Closure

public class StringLength
extends AbstractClosure

Returns the Integer length of an object's string form, or zero if the object is null.

Author:
Keith Donald
See Also:
Serialized Form

Constructor Summary
StringLength()
           
 
Method Summary
 Object call(Object value)
          Evaluate the string form of the object returning an Integer representing the string length.
static Closure instance()
          Returns the shared StringLength instance--this is possible as the default instance is immutable and stateless.
 String toString()
           
 
Methods inherited from class org.springframework.core.closure.support.AbstractClosure
forEach, forEach
 
Methods inherited from class org.springframework.core.closure.support.AlgorithmsAccessor
allTrue, allTrue, anyTrue, anyTrue, findAll, findAll, findFirst, findFirst, forEach, forEach, getAlgorithms
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringLength

public StringLength()
Method Detail

instance

public static Closure instance()
Returns the shared StringLength instance--this is possible as the default instance is immutable and stateless.

Returns:
the shared instance

call

public Object call(Object value)
Evaluate the string form of the object returning an Integer representing the string length.

Parameters:
value - the argument
Returns:
The string length Integer.
See Also:
Closure.call(java.lang.Object)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.