Class AttributeSpecNormalization

Object
AttributeSpecNormalization

@Internal public class AttributeSpecNormalization extends Object

Provides normalization for attribute spec parameters.

Attribute spec parameters are normalized. This means that if the value of a parameter is the default for that parameter, it is not stored in the map. For example, int parameters have default equal to 0. If you try to build an attribute spec and set an int parameter to 0, the resulting attribute spec will not have that value.

This is done to avoid unequal instances of AttributeSpec to represent the same attribute. If not normalized, multiple versions of the same attribute spec could lead to bugs.

Non-standard defaults

Some parameters for some specs are known to have non-standard defaults. The normalization then works by removing the parameter only if it is set to the default value.

For example, for "aggregation-parent" attribute if you set the "level" parameter to -1, it will be removed, but if you set it to 0, it will not be removed.

See KNOWN_NON_STANDARD_INT_DEFAULTS.

Normalizing attribute parameters

If there's an object parameter that looks like it's an attribute parameter (has "id" parameter itself), then it will also be normalized.

  • Constructor Details

    • AttributeSpecNormalization

      public AttributeSpecNormalization()
  • Method Details

    • normalizeParams

      @NotNull public static Map<String,Object> normalizeParams(@NotNull String specId, @NotNull Map<String,Object> specParams)
      Does normalization based on the rules at https://dev.almworks.com/browse/STR-1464 See also AttributeSpecNormalization.js
      Parameters:
      specParams -
      Returns:
      normalized specParams