Class FormatDataPolicy
- java.lang.Object
-
- com.orchestranetworks.addon.dqid.common.FormatDataPolicy
-
public final class FormatDataPolicy extends java.lang.ObjectRepresents the policy to format and parse various data types.- Since:
- 1.4.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringformatDateValue(com.orchestranetworks.schema.SchemaTypeName typeName, java.util.Date date)Returns the displaying format of a date instance by specifying a schema type name and a locale.static java.lang.StringformatIntervalValue(IntervalType intervalType, java.math.BigDecimal number)Returns the interval format of a big decimal instance by specifying an interval type.static java.lang.StringformatIntervalValue(IntervalType intervalType, java.math.BigDecimal number, java.util.Locale locale)Returns the interval format of a big decimal instance by specifying an interval type and a locale.static java.lang.String[]formatIntervalValueForDashboardTile(IntervalType intervalType, java.math.BigDecimal number, java.util.Locale locale)static java.lang.StringformatNumeric(com.orchestranetworks.schema.SchemaTypeName schemaTypeName, java.lang.Number number)Returns the displaying format of a number by specifying a schema type name.static java.lang.StringformatParameterValue(java.lang.Object value, com.orchestranetworks.schema.SchemaTypeName dataType, java.lang.String valueFormat, com.orchestranetworks.service.Session session)static java.lang.StringformatPercentageValue(java.math.BigDecimal number)Returns the percentage format of a big decimal instance using the default locale.static java.lang.StringformatPercentageValue(java.math.BigDecimal number, java.util.Locale locale)Returns the percentage format of a big decimal instance by specifying a locale.static java.lang.StringformatValue(com.orchestranetworks.schema.SchemaTypeName typeName, java.lang.Object value, java.util.Locale locale)Returns the displaying format of an object by specifying a schema type name and a locale.static booleanisDateOnly(java.util.Date date)Returnstrueif the date instance doesn't carry the time part.static java.util.DateparseDate(DataTypeFormat dataTypeFormat, java.lang.String value)Returns a date instance from a string value by specifying aDataTypeFormat.static java.util.DateparseDate(com.orchestranetworks.schema.SchemaTypeName typeName, java.lang.String value)Returns a date instance from a string value by specifying a schema type name.static java.math.BigDecimalparseNumeric(com.orchestranetworks.schema.SchemaTypeName schemaTypeName, java.lang.String value)Returns a big decimal instance of a string value by specifying a schema type name.static voidvalidValueInRange(com.orchestranetworks.schema.SchemaTypeName typeName, java.lang.String min, java.lang.String max, java.lang.String value)Validates a value against a range by specifying a schema type name.
-
-
-
Method Detail
-
formatValue
public static java.lang.String formatValue(com.orchestranetworks.schema.SchemaTypeName typeName, java.lang.Object value, java.util.Locale locale)Returns the displaying format of an object by specifying a schema type name and a locale.
-
formatDateValue
public static java.lang.String formatDateValue(com.orchestranetworks.schema.SchemaTypeName typeName, java.util.Date date)Returns the displaying format of a date instance by specifying a schema type name and a locale.- Throws:
java.lang.IllegalArgumentException- if the schema type is not a date type.- See Also:
DataTypeFormat.isDateType()
-
parseDate
public static java.util.Date parseDate(com.orchestranetworks.schema.SchemaTypeName typeName, java.lang.String value) throws DQIdExceptionReturns a date instance from a string value by specifying a schema type name.- Throws:
java.lang.IllegalArgumentException- if the schema type is not a date type.DQIdException- See Also:
DataTypeFormat.isDateType(),parseDate(DataTypeFormat, String)
-
parseDate
public static java.util.Date parseDate(DataTypeFormat dataTypeFormat, java.lang.String value) throws DQIdException
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:
DataTypeFormat
-
isDateOnly
public static boolean isDateOnly(java.util.Date date)
Returnstrueif the date instance doesn't carry the time part.
-
formatNumeric
public static java.lang.String formatNumeric(com.orchestranetworks.schema.SchemaTypeName schemaTypeName, java.lang.Number number)Returns the displaying format of a number by specifying a schema type name.- Throws:
java.lang.IllegalArgumentException- if the schema type is not a numeric type.- See Also:
DataTypeFormat.isNumeric()
-
parseNumeric
public static java.math.BigDecimal parseNumeric(com.orchestranetworks.schema.SchemaTypeName schemaTypeName, java.lang.String value)Returns a big decimal instance of a string value by specifying a schema type name.- Throws:
java.lang.IllegalArgumentException- if the schema type is not a numeric type.- See Also:
DataTypeFormat.isNumeric()
-
formatPercentageValue
public static java.lang.String formatPercentageValue(java.math.BigDecimal number)
Returns the percentage format of a big decimal instance using the default locale.
-
formatPercentageValue
public static java.lang.String formatPercentageValue(java.math.BigDecimal number, java.util.Locale locale)Returns the percentage format of a big decimal instance by specifying a locale.
-
formatIntervalValue
public static java.lang.String formatIntervalValue(IntervalType intervalType, java.math.BigDecimal number)
Returns the interval format of a big decimal instance by specifying an interval type.- Throws:
java.lang.IllegalArgumentException- if the interval type isnull.
-
formatIntervalValue
public static java.lang.String formatIntervalValue(IntervalType intervalType, java.math.BigDecimal number, java.util.Locale locale)
Returns the interval format of a big decimal instance by specifying an interval type and a locale.- Throws:
java.lang.IllegalArgumentException- if the interval type isnull.
-
formatIntervalValueForDashboardTile
public static java.lang.String[] formatIntervalValueForDashboardTile(IntervalType intervalType, java.math.BigDecimal number, java.util.Locale locale)
-
validValueInRange
public static void validValueInRange(com.orchestranetworks.schema.SchemaTypeName typeName, java.lang.String min, java.lang.String max, java.lang.String value) throws DQIdExceptionValidates a value against a range by specifying a schema type name.- Throws:
java.lang.IllegalArgumentException- if the schema type is neither a numeric type nor a date type.DQIdException- See Also:
DataTypeFormat.isNumeric(),DataTypeFormat.isDateType()
-
formatParameterValue
public static java.lang.String formatParameterValue(java.lang.Object value, com.orchestranetworks.schema.SchemaTypeName dataType, java.lang.String valueFormat, com.orchestranetworks.service.Session session)
-
-