Class NumberFormatParser
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.filter.FormatParser
-
- org.pentaho.reporting.engine.classic.core.filter.NumberFormatParser
-
- All Implemented Interfaces:
Serializable
,Cloneable
,DataFilter
,DataSource
,DataTarget
- Direct Known Subclasses:
DecimalFormatParser
public class NumberFormatParser extends FormatParser
A filter that parses the numeric value from a data source string into a number representation. This filter will parse the string obtained from the datasource into a java.lang.Number objects using a java.text.NumericFormat. If the object read from the datasource is no number, the NullValue defined by setNullValue(Object) is returned.- Author:
- Thomas Morgner
- See Also:
NumberFormat
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description NumberFormatParser()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getMaximumFractionDigits()
Returns the maximum number of fraction digits.int
getMaximumIntegerDigits()
Returns the maximum number of integer digits.int
getMinimumFractionDigits()
Returns the minimum number of fraction digits.int
getMinimumIntegerDigits()
Returns the minimum number of integer digits.NumberFormat
getNumberFormat()
Returns the number format.boolean
isGroupingUsed()
Returns the value of the grouping flag for the current number format.protected boolean
isValidOutput(Object o)
Checks whether the given value is already a valid result.void
setFormatter(Format f)
Sets the formatter.void
setGroupingUsed(boolean newValue)
Turns grouping on or off for the current number format.void
setMaximumFractionDigits(int newValue)
Sets the maximum number of fraction digits for the current number format.void
setMaximumIntegerDigits(int newValue)
Sets the maximum number of digits in the integer part of the current number format.void
setMinimumFractionDigits(int newValue)
Sets the minimum number of fraction digits for the current number format.void
setMinimumIntegerDigits(int newValue)
Sets the minimum number of digits in the integer part of the current number format.void
setNumberFormat(NumberFormat nf)
Sets the number format.-
Methods inherited from class org.pentaho.reporting.engine.classic.core.filter.FormatParser
clone, getDataSource, getFormatter, getNullValue, getValue, setDataSource, setNullValue
-
-
-
-
Method Detail
-
setNumberFormat
public void setNumberFormat(NumberFormat nf)
Sets the number format.- Parameters:
nf
- The number format.
-
getNumberFormat
public NumberFormat getNumberFormat()
Returns the number format.- Returns:
- The number format.
-
setFormatter
public void setFormatter(Format f)
Sets the formatter.- Overrides:
setFormatter
in classFormatParser
- Parameters:
f
- The format.
-
setGroupingUsed
public void setGroupingUsed(boolean newValue)
Turns grouping on or off for the current number format.- Parameters:
newValue
- The new value of the grouping flag.
-
isGroupingUsed
public boolean isGroupingUsed()
Returns the value of the grouping flag for the current number format.- Returns:
- The grouping flag.
-
setMaximumFractionDigits
public void setMaximumFractionDigits(int newValue)
Sets the maximum number of fraction digits for the current number format.- Parameters:
newValue
- The number of digits.
-
getMaximumFractionDigits
public int getMaximumFractionDigits()
Returns the maximum number of fraction digits.- Returns:
- The digits.
-
setMaximumIntegerDigits
public void setMaximumIntegerDigits(int newValue)
Sets the maximum number of digits in the integer part of the current number format.- Parameters:
newValue
- The number of digits.
-
getMaximumIntegerDigits
public int getMaximumIntegerDigits()
Returns the maximum number of integer digits.- Returns:
- The digits.
-
setMinimumFractionDigits
public void setMinimumFractionDigits(int newValue)
Sets the minimum number of fraction digits for the current number format.- Parameters:
newValue
- The number of digits.
-
getMinimumFractionDigits
public int getMinimumFractionDigits()
Returns the minimum number of fraction digits.- Returns:
- The digits.
-
setMinimumIntegerDigits
public void setMinimumIntegerDigits(int newValue)
Sets the minimum number of digits in the integer part of the current number format.- Parameters:
newValue
- The number of digits.
-
getMinimumIntegerDigits
public int getMinimumIntegerDigits()
Returns the minimum number of integer digits.- Returns:
- The digits.
-
isValidOutput
protected boolean isValidOutput(Object o)
Checks whether the given value is already a valid result. IF the datasource already returned a valid value, and no parsing is required, a parser can skip the parsing process by returning true in this function.- Overrides:
isValidOutput
in classFormatParser
- Parameters:
o
- the value to parse.- Returns:
- true, if the given object is already an instance of number.
-
-