Package com.inet.report
Class DefaultValue
java.lang.Object
com.inet.report.DefaultValue
- All Implemented Interfaces:
Serializable
,Cloneable
Holder for a
PromptField
's default value and its description. If the default value does not have a description, getDescription()
will return null. The default value's "value" may be
null.- Since:
- 7.6
- See Also:
-
Constructor Summary
ModifierConstructorDescriptionDefaultValue
(Object value, String description) Creates a default value with field value type set as UNKNOWNDefaultValue
(Object value, String description, int type) Creates a DefaultValue with the given value and description.protected
DefaultValue
(String description, int type) internal constructor -
Method Summary
Modifier and TypeMethodDescriptionclone()
static DefaultValue
createBinaryDefaultValue
(String value, String description) Creates and returns a default value of value type Field.BINARY.static DefaultValue
createDefaultValueFromFormula
(String value, String description, int valueType, Engine engine) Creates and returns a default value by parsing the given value string as a CC formula.static DefaultValue
createDefaultValueFromFormula
(String value, String description, Engine engine) Creates and returns a default value by parsing the given value string as a CC formula.static com.inet.report.FormulaDefaultValue
createFormulaFieldDefaultValueFromFormula
(FormulaField formulaField, String description, int valueType, Engine engine) creates and returns a default value based on the formula given.boolean
Returns the description of this default value.int
getType()
Returns the value type set in the constructor for this default valuegetValue()
Returns the value of this default value.int
hashCode()
void
setDescription
(String description) Sets the description of this default value.void
Sets the value of this default value.
-
Constructor Details
-
DefaultValue
internal constructor- Parameters:
description
- description of default valuetype
- value type of default value- Since:
- 11.0
-
DefaultValue
Creates a DefaultValue with the given value and description. The object must be of a certain type, depending on the value type of the Prompt Field:NUMBER
:java.lang.Double
CURRENCY
:java.lang.Double
BOOLEAN
:java.lang.Boolean
DATE
:java.sql.Date
TIME
:java.sql.Time
DATETIME
:java.sql.Timestamp
STRING
:java.lang.String
Range
:com.inet.report.FormulaRange
- Parameters:
value
- Value of the default valuedescription
- Description of the default value, can be null if there is no descriptiontype
- field type of the prompt field to which this default value belongs- Throws:
IllegalArgumentException
- if the field type does not match the object type or if the field type is unknown- Since:
- 7.6
- See Also:
-
DefaultValue
Creates a default value with field value type set as UNKNOWN- Parameters:
value
- value of the default valuedescription
- description of the default value, may be null- Since:
- 7.6
- See Also:
-
-
Method Details
-
createDefaultValueFromFormula
public static DefaultValue createDefaultValueFromFormula(String value, String description, Engine engine) throws ReportException Creates and returns a default value by parsing the given value string as a CC formula.- Parameters:
value
- value as formula syntaxdescription
- description of the default value, can be nullengine
- engine used to parse the formula- Returns:
- created default value
- Throws:
ReportException
- if an error occurs while parsing the formula- Since:
- 7.6
-
createDefaultValueFromFormula
public static DefaultValue createDefaultValueFromFormula(String value, String description, int valueType, Engine engine) throws ReportException Creates and returns a default value by parsing the given value string as a CC formula. Checks to make sure the formula's value type is the same as the value type given.- Parameters:
value
- value as formula syntaxdescription
- description of the default value, can be nullvalueType
- value type of the default value to be created.engine
- engine used to parse the formula- Returns:
- created default value
- Throws:
ReportException
- if an error occurs while parsing the formula- Since:
- 7.6
-
createFormulaFieldDefaultValueFromFormula
public static com.inet.report.FormulaDefaultValue createFormulaFieldDefaultValueFromFormula(FormulaField formulaField, String description, int valueType, Engine engine) creates and returns a default value based on the formula given. When a prompt is created with FormulaDefaultValues, the values are parsed at run-time, making it possible to have dynamically created yet "static" default values- Parameters:
formulaField
- formula field to base default value ondescription
- description of default valuevalueType
- value type of default valueengine
- engine used to parse the formula- Returns:
- created formula default value
- Since:
- 11.0
-
createBinaryDefaultValue
Creates and returns a default value of value type Field.BINARY. The value string is parsed as a Base64 encoded byte array.- Parameters:
value
- Base64-encoded byte array as stringdescription
- description of the default value, can be null- Returns:
- Created default value
- Since:
- 7.6
-
getValue
Returns the value of this default value. Can be null. The type of this value depends on the type of the prompt field.
NUMBER
:java.lang.Double
CURRENCY
:java.lang.Double
BOOLEAN
:java.lang.Boolean
DATE
:java.sql.Date
TIME
:java.sql.Time
DATETIME
:java.sql.Timestamp
STRING
:java.lang.String
Range
:com.inet.report.FormulaRange
- Returns:
- Value of this default value. Can be null.
- Since:
- 7.6
- See Also:
-
setValue
Sets the value of this default value. Can be null. The type of the object allowed to be set depends of the type of the prompt field.
NUMBER
:java.lang.Double
CURRENCY
:java.lang.Double
BOOLEAN
:java.lang.Boolean
DATE
:java.sql.Date
TIME
:java.sql.Time
DATETIME
:java.sql.Timestamp
STRING
:java.lang.String
Range
:com.inet.report.FormulaRange
- Parameters:
value
- value to set.- Since:
- 7.6
- See Also:
-
getDescription
Returns the description of this default value. Will be null if there is no description for this DefaultValue.- Returns:
- the description of this default value
- Since:
- 7.6
-
setDescription
Sets the description of this default value. The description can be set to null which means this default value has not description- Parameters:
description
- description to set for this default value- Since:
- 7.6
-
getType
public int getType()Returns the value type set in the constructor for this default value- Returns:
- field value type of this default value.
- Since:
- 7.6
- See Also:
-
equals
-
hashCode
public int hashCode() -
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-