org.jaxen.function
Class ContainsFunction

java.lang.Object
  extended by org.jaxen.function.ContainsFunction
All Implemented Interfaces:
Function

public class ContainsFunction
extends Object
implements Function

4.2 boolean contains(string,string)

The contains function returns true if the first argument string contains the second argument string, and otherwise returns false.

Author:
bob mcwhirter (bob @ werken.com)
See Also:
Section 4.2 of the XPath Specification

Constructor Summary
ContainsFunction()
          Create a new ContainsFunction object.
 
Method Summary
 Object call(Context context, List args)
           Returns true if the string-value of the first item in args contains string-value of the second item; false otherwise.
static Boolean evaluate(Object strArg, Object matchArg, Navigator nav)
          Returns true if the first string contains the second string; false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContainsFunction

public ContainsFunction()
Create a new ContainsFunction object.

Method Detail

call

public Object call(Context context,
                   List args)
            throws FunctionCallException

Returns true if the string-value of the first item in args contains string-value of the second item; false otherwise. If necessary one or both items are converted to a string as if by the XPath string() function.

Specified by:
call in interface Function
Parameters:
context - the context at the point in the expression when the function is called
args - a list containing exactly two items
Returns:
the result of evaluating the function; Boolean.TRUE or Boolean.FALSE
Throws:
FunctionCallException - if args does not have exactly two items

evaluate

public static Boolean evaluate(Object strArg,
                               Object matchArg,
                               Navigator nav)

Returns true if the first string contains the second string; false otherwise. If necessary one or both arguments are converted to a string as if by the XPath string() function.

Parameters:
strArg - the containing string
matchArg - the contained string
nav - used to calculate the string-values of the first two arguments
Returns:
Boolean.TRUE if true if the first string contains the second string; Boolean.FALSE otherwise.


Copyright © 2001-2008 Codehaus. All Rights Reserved.