Class EntityIDDigestGenerator

All Implemented Interfaces:
Direct Known Subclasses:

public class EntityIDDigestGenerator extends Object implements Function<CriteriaSet,String>
Strategy for processing input criteria to extract the entityID from an EntityIdCriterion and produce the digest of the value.

By default the digest strategy used is the SHA-1 algorithm, with output in lower-case hexadecimal. By default, prefix, suffix and value separator are null.

  • Field Details

    • digester

      @Nonnull private StringDigester digester
      String digester for the EntityDescriptor's entityID.
    • prefix

      @Nullable private String prefix
      Prefix to prepend to the digested value.
    • suffix

      @Nullable private String suffix
      Suffix to append to the digested value.
    • separator

      @Nullable private String separator
      Common separator between prefix, digested and suffix values.
  • Constructor Details

    • EntityIDDigestGenerator

      public EntityIDDigestGenerator()
    • EntityIDDigestGenerator

      public EntityIDDigestGenerator(@Nullable StringDigester valueDigester, @Nullable String keyPrefix, @Nullable String keySuffix, @Nullable String valueSeparator)
      valueDigester - optional digeser for the entityID value
      keyPrefix - optional prefix for the digested value
      keySuffix - optional suffix for the digested value
      valueSeparator - optional separator between the prefix, digest and suffix values
  • Method Details

    • apply

      @Nullable public String apply(@Nullable CriteriaSet criteria)
      Specified by:
      apply in interface Function<CriteriaSet,String>
    • buildKey

      protected String buildKey(@Nonnull String keyValue)
      Build the key by applying the configured prefix and/or suffix, if present.
      keyValue - the primary key value data being represented
      the key value with prefix and suffix applied