Class FormatDataPolicy
java.lang.Object
com.orchestranetworks.addon.dqid.common.FormatDataPolicy
Represents the policy to format and parse various data types.
- Since:
- 1.4.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
formatDateValue
(com.orchestranetworks.schema.SchemaTypeName typeName, Date date) Returns the displaying format of a date instance by specifying a schema type name and a locale.static String
formatIntervalValue
(IntervalType intervalType, BigDecimal number) Returns the interval format of a big decimal instance by specifying an interval type.static String
formatIntervalValue
(IntervalType intervalType, BigDecimal number, Locale locale) Returns the interval format of a big decimal instance by specifying an interval type and a locale.static String[]
formatIntervalValueForDashboardTile
(IntervalType intervalType, BigDecimal number, Locale locale) static String
formatNumeric
(com.orchestranetworks.schema.SchemaTypeName schemaTypeName, Number number) Returns the displaying format of a number by specifying a schema type name.static String
formatParameterValue
(Object value, com.orchestranetworks.schema.SchemaTypeName dataType, String valueFormat, com.orchestranetworks.service.Session session) static String
formatPercentageValue
(BigDecimal number) Returns the percentage format of a big decimal instance using the default locale.static String
formatPercentageValue
(BigDecimal number, Locale locale) Returns the percentage format of a big decimal instance by specifying a locale.static String
formatValue
(com.orchestranetworks.schema.SchemaTypeName typeName, Object value, Locale locale) Returns the displaying format of an object by specifying a schema type name and a locale.static boolean
isDateOnly
(Date date) Returnstrue
if the date instance doesn't carry the time part.static Date
parseDate
(DataTypeFormat dataTypeFormat, String value) Returns a date instance from a string value by specifying aDataTypeFormat
.static Date
Returns a date instance from a string value by specifying a schema type name.static BigDecimal
parseNumeric
(com.orchestranetworks.schema.SchemaTypeName schemaTypeName, String value) Returns a big decimal instance of a string value by specifying a schema type name.static void
validValueInRange
(com.orchestranetworks.schema.SchemaTypeName typeName, String min, String max, String value) Validates a value against a range by specifying a schema type name.
-
Method Details
-
formatValue
public static String formatValue(com.orchestranetworks.schema.SchemaTypeName typeName, Object value, Locale locale) Returns the displaying format of an object by specifying a schema type name and a locale. -
formatDateValue
public static String formatDateValue(com.orchestranetworks.schema.SchemaTypeName typeName, Date date) Returns the displaying format of a date instance by specifying a schema type name and a locale.- Throws:
IllegalArgumentException
- if the schema type is not a date type.- See Also:
-
parseDate
public static Date parseDate(com.orchestranetworks.schema.SchemaTypeName typeName, String value) throws DQIdException Returns a date instance from a string value by specifying a schema type name.- Throws:
IllegalArgumentException
- if the schema type is not a date type.DQIdException
- See Also:
-
parseDate
Returns a date instance from a string value by specifying aDataTypeFormat
.- Throws:
DQIdException
- if the date format is invalid.- Since:
- 2.1.0
- See Also:
-
isDateOnly
Returnstrue
if the date instance doesn't carry the time part. -
formatNumeric
public static String formatNumeric(com.orchestranetworks.schema.SchemaTypeName schemaTypeName, Number number) Returns the displaying format of a number by specifying a schema type name.- Throws:
IllegalArgumentException
- if the schema type is not a numeric type.- See Also:
-
parseNumeric
public static BigDecimal parseNumeric(com.orchestranetworks.schema.SchemaTypeName schemaTypeName, String value) Returns a big decimal instance of a string value by specifying a schema type name.- Throws:
IllegalArgumentException
- if the schema type is not a numeric type.- See Also:
-
formatPercentageValue
Returns the percentage format of a big decimal instance using the default locale. -
formatPercentageValue
Returns the percentage format of a big decimal instance by specifying a locale. -
formatIntervalValue
Returns the interval format of a big decimal instance by specifying an interval type.- Throws:
IllegalArgumentException
- if the interval type isnull
.
-
formatIntervalValue
public static String formatIntervalValue(IntervalType intervalType, BigDecimal number, Locale locale) Returns the interval format of a big decimal instance by specifying an interval type and a locale.- Throws:
IllegalArgumentException
- if the interval type isnull
.
-
formatIntervalValueForDashboardTile
public static String[] formatIntervalValueForDashboardTile(IntervalType intervalType, BigDecimal number, Locale locale) -
validValueInRange
public static void validValueInRange(com.orchestranetworks.schema.SchemaTypeName typeName, String min, String max, String value) throws DQIdException Validates a value against a range by specifying a schema type name.- Throws:
IllegalArgumentException
- if the schema type is neither a numeric type nor a date type.DQIdException
- See Also:
-
formatParameterValue
-