Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jaxen.function
Class StringFunction

    java.lang.Object
      org.jaxen.function.StringFunction

All Implemented Interfaces:
  Function

public class StringFunction
extends Object
implements Function

4.2 `string string(object)`

> The string function converts an object to a string as follows:

> - A node-set is converted to a string by returning the string-value of the node in the node-set that is first in document order. If the node-set is empty, an empty string is returned.

> - A number is converted to a string as follows

>   - NaN is converted to the string `NaN`

>   - positive zero is converted to the string `0`

>   - negative zero is converted to the string `0`

>   - positive infinity is converted to the string `Infinity`

>   - negative infinity is converted to the string `-Infinity`

>   - if the number is an integer, the number is represented in decimal form as a Number with no decimal point and no leading zeros, preceded by a minus sign (`-`) if the number is negative

>   - otherwise, the number is represented in decimal form as a Number including a decimal point with at least one digit before the decimal point and at least one digit after the decimal point, preceded by a minus sign (`-`) if the number is negative; there must be no leading zeros before the decimal point apart possibly from the one required digit immediately before the decimal point; beyond the one required digit after the decimal point there must be as many, but only as many, more digits as are needed to uniquely distinguish the number from all other IEEE 754 numeric values.

> - The boolean false value is converted to the string `false`. The boolean true value is converted to the string `true`.

> - An object of a type other than the four basic types is converted to a string in a way that is dependent on that type.

> If the argument is omitted, it defaults to a node-set with the context node as its only member.

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

Constructor Summary
`StringFunction()` Create a new `StringFunction` object.

Method Summary
`Object` | `call(Context context, List args)` Returns the string-value of `args.get(0)` or of the context node if ,code>args is empty.
`static String` | `evaluate(Object obj, Navigator nav)` Returns the string-value of `obj`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### StringFunction

    public StringFunction()

  Create a new `StringFunction` object.

Method Detail

### call

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

  Returns the string-value of `args.get(0)` or of the context node if ,code>args is empty.

  Specified by:
    `call` in interface `Function`
  Parameters:
    `context` - the context at the point in the expression where the function is called
    `args` - list with zero or one element
  Returns:
    a `String`
  Throws:
    `FunctionCallException` - if `args` has more than one item

### evaluate

    public static String evaluate(Object obj,
                                  Navigator nav)

  Returns the string-value of `obj`.

  Parameters:
    `obj` - the object whose string-value is calculated
    `nav` - the navigator used to calculate the string-value
  Returns:
    a `String`. May be empty but is never null.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005 Codehaus. All Rights Reserved.