org.jaxen.function

Class StartsWithFunction

Implemented Interfaces:
Function

public class StartsWithFunction
extends java.lang.Object
implements Function

4.2 boolean starts-with(string,string)
The starts-with function returns true if the first argument string starts with 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

StartsWithFunction()
Create a new StartsWithFunction object.

Method Summary

Object
call(Context context, List args)
Returns true if the string-value of the first item in args starts with the string-value of the second item in args.
static Boolean
evaluate(Object strArg, Object matchArg, Navigator nav)
Returns true if the string-value of strArg starts with the string-value of matchArg.

Constructor Details

StartsWithFunction

public StartsWithFunction()
Create a new StartsWithFunction object.

Method Details

call

public Object call(Context context,
                   List args)
            throws FunctionCallException
Returns true if the string-value of the first item in args starts with the string-value of the second item in args. Otherwise it returns false.
Specified by:
call in interface Function
Parameters:
context - the context at the point in the expression when the function is called
args - a list that contains two items
Returns:
Boolean.TRUE if the first item in args starts with the string-value of the second item in args; otherwise Boolean.FALSE
Throws:
FunctionCallException - if args does not have length two

evaluate

public static Boolean evaluate(Object strArg,
                               Object matchArg,
                               Navigator nav)
Returns true if the string-value of strArg starts with the string-value of matchArg. Otherwise it returns false.
Parameters:
strArg - the object whose string-value searched for the prefix
matchArg - the object whose string-value becomes the prefix string to compare against
nav - the navigator used to calculate the string-values of the arguments
Returns:
Boolean.TRUE if the string-value of strArg starts with the string-value of matchArg; otherwise Boolean.FALSE