org.pf.textx
Class BasicTextFunctionResolver

java.lang.Object
  extended by org.pf.textx.BasicTextFunctionResolver
All Implemented Interfaces:
FunctionResolver

public class BasicTextFunctionResolver
extends java.lang.Object
implements FunctionResolver

This class provides support for some basic functions, that are useful in text replacement done by a TextEngine.

Version:
1.1
Author:
Manfred Duchrow
See Also:
TextEngine

Field Summary
static java.lang.String DATE
          Name for a function that gets one string parameter and returns it with a lower case first letter.
static java.lang.String LOWERCASE
          Name for a function that gets one string parameter and returns it with all letters changed to lower case.
static java.lang.String LOWERCASE_FIRST_LETTER
          Name for a function that gets one string parameter and returns it with a lower case first letter.
static java.lang.String UPPERCASE
          Name for a function that gets one string parameter and returns it with all letters changed to upper case.
static java.lang.String UPPERCASE_FIRST_LETTER
          Name for a function that gets one string parameter and returns it with a capitalized first letter.
 
Constructor Summary
BasicTextFunctionResolver()
           
 
Method Summary
 java.lang.Object executeFunction(java.lang.String functionName, java.util.Vector parameter)
          Returns the value for the function with the given name.
 boolean isKnownFunction(java.lang.String functionName)
          Returns if the function with the given name can be resolved by the receiver.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UPPERCASE_FIRST_LETTER

public static final java.lang.String UPPERCASE_FIRST_LETTER
Name for a function that gets one string parameter and returns it with a capitalized first letter. Example: UC1("random") ==> "Random"

See Also:
Constant Field Values

LOWERCASE_FIRST_LETTER

public static final java.lang.String LOWERCASE_FIRST_LETTER
Name for a function that gets one string parameter and returns it with a lower case first letter. Example: LC1("FirstEntry") ==> "firstEntry"

See Also:
Constant Field Values

UPPERCASE

public static final java.lang.String UPPERCASE
Name for a function that gets one string parameter and returns it with all letters changed to upper case. Example: UC1("random") ==> "RANDOM"

See Also:
Constant Field Values

LOWERCASE

public static final java.lang.String LOWERCASE
Name for a function that gets one string parameter and returns it with all letters changed to lower case. Example: LC("FirstEntry") ==> "firstentry"

See Also:
Constant Field Values

DATE

public static final java.lang.String DATE
Name for a function that gets one string parameter and returns it with a lower case first letter. Example: Date() ==> "January 12, 1999"

See Also:
Constant Field Values
Constructor Detail

BasicTextFunctionResolver

public BasicTextFunctionResolver()
Method Detail

executeFunction

public java.lang.Object executeFunction(java.lang.String functionName,
                                        java.util.Vector parameter)
                                 throws UnknownFunctionException,
                                        InvalidParameterException
Returns the value for the function with the given name.

Specified by:
executeFunction in interface FunctionResolver
Parameters:
functionName - The case sensitive name of the function.
parameter - A collection of parameters for the function.
Returns:
The evaluation of the function with the given parameters (null is a valid return value)
Throws:
UnknownFunctionException - The receiver is not knowing the function.
InvalidParameterException

isKnownFunction

public boolean isKnownFunction(java.lang.String functionName)
Returns if the function with the given name can be resolved by the receiver.

Specified by:
isKnownFunction in interface FunctionResolver
Parameters:
functionName - The case sensitive name of the function.
Returns:
Whether the function with the given name is known or not.