Class FormatDataPolicy

java.lang.Object
com.orchestranetworks.addon.dqid.common.FormatDataPolicy

public final class FormatDataPolicy extends Object
Represents the policy to format and parse various data types.
Since:
1.4.0
  • 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

      public static Date parseDate(DataTypeFormat dataTypeFormat, String value) throws DQIdException
      Returns a date instance from a string value by specifying a DataTypeFormat.
      Throws:
      DQIdException - if the date format is invalid.
      Since:
      2.1.0
      See Also:
    • isDateOnly

      public static boolean isDateOnly(Date date)
      Returns true 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

      public static String formatPercentageValue(BigDecimal number)
      Returns the percentage format of a big decimal instance using the default locale.
    • formatPercentageValue

      public static String formatPercentageValue(BigDecimal number, Locale locale)
      Returns the percentage format of a big decimal instance by specifying a locale.
    • formatIntervalValue

      public static String formatIntervalValue(IntervalType intervalType, BigDecimal number)
      Returns the interval format of a big decimal instance by specifying an interval type.
      Throws:
      IllegalArgumentException - if the interval type is null.
    • 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 is null.
    • 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

      public static String formatParameterValue(Object value, com.orchestranetworks.schema.SchemaTypeName dataType, String valueFormat, com.orchestranetworks.service.Session session)