|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.slamd.scripting.engine.Variable
com.sun.slamd.scripting.general.StringVariable
This class defines a string variable that has an string value. It also defines a set of methods for dealing with string variables:
| Field Summary | |
static java.lang.String |
APPEND_METHOD_NAME
The name of the method that will be used to append strings together. |
static int |
APPEND_METHOD_NUMBER
The method number for the "append" method. |
static int |
ASSIGN_1_METHOD_NUMBER
The method number for the first "assign" method. |
static int |
ASSIGN_2_METHOD_NUMBER
The method number for the second "assign" method. |
static java.lang.String |
ASSIGN_METHOD_NAME
The name of the method that will be used to assign a value to the variable. |
static java.lang.String |
COMPARE_TO_METHOD_NAME
The name of the method that will perform lexicographical comparisons of strings. |
static int |
COMPARE_TO_METHOD_NUMBER
The method number for the "compareTo" method. |
static java.lang.String |
CONTAINS_METHOD_NAME
The name of the method that will determine whether this string contains a specified substring. |
static int |
CONTAINS_METHOD_NUMBER
The method number for the "contains" method. |
static java.lang.String |
ENDS_WITH_METHOD_NAME
The name of the method that will determine whether this string ends with a specified substring. |
static int |
ENDS_WITH_METHOD_NUMBER
The method number for the "endsWith" method. |
static java.lang.String |
EQUALS_METHOD_NAME
The name of the method that will determine whether two strings are equal. |
static int |
EQUALS_METHOD_NUMBER
The method number for the "equals" method. |
static int |
INDEX_OF_1_METHOD_NUMBER
The method number for the first "indexOf" method. |
static int |
INDEX_OF_2_METHOD_NUMBER
The method number for the second "indexOf" method. |
static java.lang.String |
INDEX_OF_METHOD_NAME
The name of the method that may be used to determine the position of a specified substring. |
static java.lang.String |
IS_NULL_METHOD_NAME
The name of the method that will determine whether this string has not been assigned a value. |
static int |
IS_NULL_METHOD_NUMBER
The method number for the isNull method. |
static int |
LAST_INDEX_OF_1_METHOD_NUMBER
The method number for the first "lastIndexOf" method. |
static int |
LAST_INDEX_OF_2_METHOD_NUMBER
The method number for the second "lastIndexOf" method. |
static java.lang.String |
LAST_INDEX_OF_METHOD_NAME
The name of the method that may be used to determine the position of the last occurrence of a specified substring. |
static java.lang.String |
LENGTH_METHOD_NAME
The name of the method that will determine the length of this string. |
static int |
LENGTH_METHOD_NUMBER
The method number for the "length" method. |
static java.lang.String |
NOT_NULL_METHOD_NAME
The name of the method that will determine whether this string has been assigned a value. |
static int |
NOT_NULL_METHOD_NUMBER
The method number for the "notNull" method. |
static java.lang.String |
SPLIT_AT_METHOD_NAME
The name of the method that will be used to split this string at a specified delimiter. |
static int |
SPLIT_AT_METHOD_NUMBER
The method number for the "splitAt" method. |
static java.lang.String |
SPLIT_AT_TABS_METHOD_NAME
The name of the method that will be used to split this string at tab characters. |
static int |
SPLIT_AT_TABS_METHOD_NUMBER
The method number for the "splitAtTabs" method. |
static java.lang.String |
STARTS_WITH_METHOD_NAME
The name of the method that will determine whether this string starts with a specified substring. |
static int |
STARTS_WITH_METHOD_NUMBER
The method number for the "startsWith" method. |
static Method[] |
STRING_VARIABLE_METHODS
The set of methods associated with string variables. |
static java.lang.String |
STRING_VARIABLE_TYPE
The name that will be used for the data type of string variables. |
static int |
SUBSTRING_1_METHOD_NUMBER
The method number for the first "substring" method. |
static int |
SUBSTRING_2_METHOD_NUMBER
The method number for the first "second" method. |
static java.lang.String |
SUBSTRING_METHOD_NAME
The name of the method that will retrieve a substring of the overall string value. |
static java.lang.String |
TO_LOWERCASE_METHOD_NAME
The name of the method that will convert the string to all lowercase. |
static int |
TO_LOWERCASE_METHOD_NUMBER
The method number for the "toLowerCase" method. |
static java.lang.String |
TO_UPPERCASE_METHOD_NAME
The name of the method that will convert the string to all uppercase. |
static int |
TO_UPPERCASE_METHOD_NUMBER
The method number for the "toUpperCase" method. |
| Constructor Summary | |
StringVariable()
Creates a new variable with no name, to be used only when creating a variable with Class.newInstance(), and only when
setName() is called after that to set the name. |
|
StringVariable(java.lang.String stringValue)
Creates a new string variable with the provided value. |
|
| Method Summary | |
void |
assign(Argument argument)
Assigns the value of the provided argument to this variable. |
Variable |
executeMethod(int lineNumber,
int methodNumber,
Argument[] arguments)
Executes the specified method, using the provided variables as arguments to the method, and makes the return value available to the caller. |
int |
getMethodNumber(java.lang.String methodName,
java.lang.String[] argumentTypes)
Retrieves the method number for the method that has the specified name and argument types, or -1 if there is no such method. |
Method[] |
getMethods()
Retrieves a list of all methods defined for this variable. |
java.lang.String |
getReturnTypeForMethod(java.lang.String methodName,
java.lang.String[] argumentTypes)
Retrieves the return type for the method with the specified name and argument types. |
java.lang.String |
getStringValue()
Retrieves the string value associated with this variable. |
java.lang.String |
getValueAsString()
Retrieves a string representation of the value of this argument. |
java.lang.String |
getVariableTypeName()
Retrieves the name of the variable type for this variable. |
boolean |
hasMethod(java.lang.String methodName)
Indicates whether this variable type has a method with the specified name. |
void |
setStringValue(java.lang.String stringValue)
Specifies the string value for this variable. |
java.lang.String |
toLowerCase()
Retrieves the string value associated with this variable, converted to lowercase. |
| Methods inherited from class com.sun.slamd.scripting.engine.Variable |
getArgumentAsString, getArgumentType, getArgumentValue, getName, getStatTrackers, isValidIdentifier, setName, startStatTrackers, stopStatTrackers |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String STRING_VARIABLE_TYPE
public static final java.lang.String APPEND_METHOD_NAME
public static final int APPEND_METHOD_NUMBER
public static final java.lang.String ASSIGN_METHOD_NAME
public static final int ASSIGN_1_METHOD_NUMBER
public static final int ASSIGN_2_METHOD_NUMBER
public static final java.lang.String COMPARE_TO_METHOD_NAME
public static final int COMPARE_TO_METHOD_NUMBER
public static final java.lang.String CONTAINS_METHOD_NAME
public static final int CONTAINS_METHOD_NUMBER
public static final java.lang.String ENDS_WITH_METHOD_NAME
public static final int ENDS_WITH_METHOD_NUMBER
public static final java.lang.String EQUALS_METHOD_NAME
public static final int EQUALS_METHOD_NUMBER
public static final java.lang.String INDEX_OF_METHOD_NAME
public static final int INDEX_OF_1_METHOD_NUMBER
public static final int INDEX_OF_2_METHOD_NUMBER
public static final java.lang.String IS_NULL_METHOD_NAME
public static final int IS_NULL_METHOD_NUMBER
public static final java.lang.String LAST_INDEX_OF_METHOD_NAME
public static final int LAST_INDEX_OF_1_METHOD_NUMBER
public static final int LAST_INDEX_OF_2_METHOD_NUMBER
public static final java.lang.String LENGTH_METHOD_NAME
public static final int LENGTH_METHOD_NUMBER
public static final java.lang.String NOT_NULL_METHOD_NAME
public static final int NOT_NULL_METHOD_NUMBER
public static final java.lang.String SPLIT_AT_METHOD_NAME
public static final int SPLIT_AT_METHOD_NUMBER
public static final java.lang.String SPLIT_AT_TABS_METHOD_NAME
public static final int SPLIT_AT_TABS_METHOD_NUMBER
public static final java.lang.String STARTS_WITH_METHOD_NAME
public static final int STARTS_WITH_METHOD_NUMBER
public static final java.lang.String SUBSTRING_METHOD_NAME
public static final int SUBSTRING_1_METHOD_NUMBER
public static final int SUBSTRING_2_METHOD_NUMBER
public static final java.lang.String TO_LOWERCASE_METHOD_NAME
public static final int TO_LOWERCASE_METHOD_NUMBER
public static final java.lang.String TO_UPPERCASE_METHOD_NAME
public static final int TO_UPPERCASE_METHOD_NUMBER
public static final Method[] STRING_VARIABLE_METHODS
| Constructor Detail |
public StringVariable()
throws ScriptException
Class.newInstance(), and only when
setName() is called after that to set the name.
ScriptException - If a problem occurs while initializing the new
variable.public StringVariable(java.lang.String stringValue)
stringValue - The value to use for this String variable.| Method Detail |
public java.lang.String getStringValue()
public java.lang.String toLowerCase()
public void setStringValue(java.lang.String stringValue)
stringValue - The string value for this variable.public java.lang.String getVariableTypeName()
getVariableTypeName in class Variablepublic Method[] getMethods()
getMethods in class Variablepublic boolean hasMethod(java.lang.String methodName)
hasMethod in class VariablemethodName - The name of the method.
true if this variable has a method with the specified
name, or false if it does not.
public int getMethodNumber(java.lang.String methodName,
java.lang.String[] argumentTypes)
getMethodNumber in class VariablemethodName - The name of the method.argumentTypes - The list of argument types for the method.
public java.lang.String getReturnTypeForMethod(java.lang.String methodName,
java.lang.String[] argumentTypes)
getReturnTypeForMethod in class VariablemethodName - The name of the method.argumentTypes - The set of argument types for the method.
null if there is
no such method defined.
public Variable executeMethod(int lineNumber,
int methodNumber,
Argument[] arguments)
throws ScriptException
executeMethod in class VariablelineNumber - The line number of the script in which the method
call occurs.methodNumber - The method number of the method to execute.arguments - The set of arguments to use for the method.
null if it
does not return a value.
ScriptException - If the specified method does not exist, or if a
problem occurs while attempting to execute it.
public void assign(Argument argument)
throws ScriptException
assign in class Variableargument - The argument whose value should be assigned to this
variable.
ScriptException - If a problem occurs while performing the
assignment.public java.lang.String getValueAsString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||