|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.pentaho.reporting.engine.classic.core.function.AbstractExpression
org.pentaho.reporting.engine.classic.core.function.strings.MapStringExpression
public class MapStringExpression
Maps a string read from a column into an other string. The possible mappings are given as (key, text) pairs. If the string from the column is null or matches none of the defined keys, a fallback value is returned.
If the fallback value is undefined, the original value is returned instead.
| Constructor Summary | |
|---|---|
MapStringExpression()
Default Constructor. |
|
| Method Summary | |
|---|---|
String |
getFallbackValue()
Returns the value that is returned if none of the predefined keys matches the lookup-value. |
String |
getField()
Returns the name of the field from where to read the key value. |
Expression |
getInstance()
Return a completly separated copy of this function. |
String[] |
getKey()
Returns all defined keys as string array. |
String |
getKey(int index)
Returns a key value at the given index. |
int |
getKeyCount()
Returns the number of keys defined in the expression. |
String |
getNullValue()
Returns the value that is returned if the key-field evaluates to null. |
String[] |
getText()
Returns all defined texts as string-array. |
String |
getText(int index)
Returns the mapped text for the key at the given position. |
int |
getTextCount()
Returns the number of replacement text defined in this expression. |
Object |
getValue()
Performs the lookup by first querying the given field, and then returning the defined text for the key-position. |
boolean |
isIgnoreCase()
Returns, whether the key-lookup should be case-insensitive. |
void |
setFallbackValue(String fallbackValue)
Defines the value that is returned if none of the predefined keys matches the lookup-value. |
void |
setField(String field)
Defines the name of the field from where to read the key value. |
void |
setIgnoreCase(boolean ignoreCase)
Defines, whether the key-lookup should be case-insensitive. |
void |
setKey(int index,
String key)
Defines a key value to which the lookup-field's value is compared. |
void |
setKey(String[] keys)
Defines all keys using the values from the string array. |
void |
setNullValue(String nullValue)
Defines the value that is returned if the key-field evaluates to null. |
void |
setText(int index,
String value)
Defines the mapped text for the key at the given position. |
void |
setText(String[] texts)
Defines all texts by using the values from the given text-array. |
| Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractExpression |
|---|
clone, getDataRow, getDependencyLevel, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isDeepTraversing, isPreserve, setActive, setDependencyLevel, setName, setPreserve, setRuntime |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MapStringExpression()
| Method Detail |
|---|
public String getField()
public void setField(String field)
field - the field name.public String getNullValue()
null.
public void setNullValue(String nullValue)
null.
nullValue - the null-value.public String getFallbackValue()
public void setFallbackValue(String fallbackValue)
fallbackValue - the fallback value.
public void setKey(int index,
String key)
index - the index position of the key in the list.key - the key value.public String getKey(int index)
index - the index position of the key in the list.
public int getKeyCount()
public String[] getKey()
public void setKey(String[] keys)
keys - all defined keys.
public void setText(int index,
String value)
index - the index of the entry.value - the text that is returned if the key is selected.public String getText(int index)
index - the index of the entry.
public int getTextCount()
public String[] getText()
public void setText(String[] texts)
texts - the new text-values.public boolean isIgnoreCase()
public void setIgnoreCase(boolean ignoreCase)
ignoreCase - true, if the key comparison is case-insensitive, false otherwise.public Expression getInstance()
getInstance in interface ExpressiongetInstance in class AbstractExpressionpublic Object getValue()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||