public class Variables extends Object implements VariableSpace
| Constructor and Description |
|---|
Variables() |
| Modifier and Type | Method and Description |
|---|---|
void |
copyVariablesFrom(VariableSpace space)
Copy the variables from another space, without initializing with the defaults.
|
String |
environmentSubstitute(String aString)
Substitute the string using the current variable space.
|
String[] |
environmentSubstitute(String[] string)
Replaces environment variables in an array of strings.
|
String |
environmentSubstitute(String aString,
boolean escapeHexDelimiter)
Substitute the string using the current variable space.
|
String |
fieldSubstitute(String aString,
RowMetaInterface rowMeta,
Object[] rowData)
Substitutes field values in
aString. |
static VariableSpace |
getADefaultVariableSpace()
Get a default variable space as a placeholder.
|
boolean |
getBooleanValueOfVariable(String variableName,
boolean defaultValue)
This method returns a boolean for the new variable check boxes.
|
VariableSpace |
getParentVariableSpace()
Get the parent of the variable space.
|
String |
getVariable(String variableName)
Get the value of a variable.
|
String |
getVariable(String variableName,
String defaultValue)
Get the value of a variable with a default in case the variable is not found.
|
void |
initializeVariablesFrom(VariableSpace parent)
Initialize variable space using the defaults, copy over the variables from the parent (using copyVariablesFrom()),
after this the "injected" variables should be inserted (injectVariables()).
|
void |
injectVariables(Map<String,String> prop)
Inject variables.
|
String[] |
listVariables()
List the variables (not the values) that are currently in the variable space.
|
void |
setParentVariableSpace(VariableSpace parent)
Set the parent variable space
|
void |
setVariable(String variableName,
String variableValue)
Sets a variable in the Kettle Variables list.
|
void |
shareVariablesWith(VariableSpace space)
Share a variable space from another variable space.
|
public void copyVariablesFrom(VariableSpace space)
VariableSpacecopyVariablesFrom in interface VariableSpacespace - the space to copy the variables from.public VariableSpace getParentVariableSpace()
VariableSpacegetParentVariableSpace in interface VariableSpacepublic void setParentVariableSpace(VariableSpace parent)
VariableSpacesetParentVariableSpace in interface VariableSpaceparent - The parent variable space to setpublic String getVariable(String variableName, String defaultValue)
VariableSpacegetVariable in interface VariableSpacevariableName - The name of the variabledefaultValue - The default value in case the variable could not be foundpublic String getVariable(String variableName)
VariableSpacegetVariable in interface VariableSpacevariableName - The name of the variablepublic boolean getBooleanValueOfVariable(String variableName, boolean defaultValue)
VariableSpacegetBooleanValueOfVariable in interface VariableSpacevariableName - The variable to look up.defaultValue - The default value to return.static method ValueMeta.convertStringToBoolean()public void initializeVariablesFrom(VariableSpace parent)
VariableSpaceinitializeVariablesFrom in interface VariableSpaceparent - the parent to start from, or null if root.public String[] listVariables()
VariableSpacelistVariables in interface VariableSpacepublic void setVariable(String variableName, String variableValue)
VariableSpacesetVariable in interface VariableSpacevariableName - The name of the variable to setvariableValue - The value of the variable to set. If the variableValue is null, the variable is cleared from the list.public String environmentSubstitute(String aString)
VariableSpaceenvironmentSubstitute in interface VariableSpaceaString - The string to substitute.public String environmentSubstitute(String aString, boolean escapeHexDelimiter)
VariableSpaceenvironmentSubstitute in interface VariableSpaceaString - The string to substitute.escapeHexDelimiter - escapes the hex delimiter substitutionpublic String fieldSubstitute(String aString, RowMetaInterface rowMeta, Object[] rowData) throws KettleValueException
aString. Field values are of the form "?{fieldSubstitute in interface VariableSpaceaString - the string on which to apply the substitution.rowMeta - The row metadata to use.rowData - The row data to useKettleValueException - In case there is a String conversion errorpublic String[] environmentSubstitute(String[] string)
VariableSpaceenvironmentSubstitute in interface VariableSpacestring - The array of strings that wants its variables to be replaced.public void shareVariablesWith(VariableSpace space)
VariableSpaceshareVariablesWith in interface VariableSpacespace - Variable space to be shared.public void injectVariables(Map<String,String> prop)
VariableSpaceinjectVariables in interface VariableSpaceprop - Properties object containing key-value pairs.public static VariableSpace getADefaultVariableSpace()
Copyright © 2020 Hitachi Vantara. All rights reserved.