Class NameUtil

java.lang.Object
com.ssgllc.fish.service.util.registered.NameUtil

@Component public final class NameUtil extends Object
  • Constructor Details

    • NameUtil

      public NameUtil()
  • Method Details

    • nickNameEquivalents

      public static Set<String> nickNameEquivalents(String field, String value)
      All configured nickname equivalents of a name for a given field, from the in-memory NickName cache. Returns the union of both directions: the names for which value is a nickname (e.g. "Bob""ROBERT") and the nicknames configured for value as a canonical name (e.g. "Robert""BOB", "ROB"). Results are upper-cased (as stored in the cache); the input is trimmed and upper-cased before lookup. Never returns null; returns an empty set when the name has no configured nicknames.

      Intended for a blocking-set query so the nickname lookup is served from cache instead of a correlated subquery against the NickName table, e.g. upper(s.firstName) in ({#nickNameEquivalents('firstName', firstName)}).
      Parameters:
      field - the NickName field/type (e.g. "firstName")
      value - the name to expand
      Returns:
      the union of matching names and nicknames, upper-cased; empty if none

      Groovy example:
      nameUtil.nickNameEquivalents("firstName", "Bob")
      SpEL example:
      #nickNameEquivalents("firstName", "Bob")
    • nickNamesFor

      public static Set<String> nickNamesFor(String field, String value)
      The configured nicknames of a canonical name for a given field, from the in-memory NickName cache — one direction only (e.g. "Robert""BOB", "ROB"). Unlike nickNameEquivalents(String, String), this does NOT also return the canonical names of a nickname, so a nickname input (e.g. "Bob") yields an empty set. Results are upper-cased (as stored in the cache); the input is trimmed and upper-cased before lookup. Never returns null; returns an empty set when the name has no configured nicknames.
      Parameters:
      field - the NickName field/type (e.g. "firstName")
      value - the canonical name whose nicknames to return
      Returns:
      the configured nicknames, upper-cased; empty if none

      Groovy example:
      nameUtil.nickNamesFor("firstName", "Robert")
      SpEL example:
      #nickNamesFor("firstName", "Robert")