Class LookupExtractor

    • Constructor Detail

      • LookupExtractor

        public LookupExtractor()
    • Method Detail

      • apply

        @Nullable
        public abstract String apply​(@Nullable
                                     String key)
        Apply a particular lookup methodology to the input string
        Parameters:
        key - The value to apply the lookup to.
        Returns:
        The lookup, or null when key is `null` or cannot have the lookup applied to it and should be treated as missing.
      • applyAll

        public Map<String,​String> applyAll​(Iterable<String> keys)
        Parameters:
        keys - set of keys to apply lookup for each element
        Returns:
        Returns Map whose keys are the contents of keys and whose values are computed on demand using lookup function unapply(String) or empty map if values is `null` User can override this method if there is a better way to perform bulk lookup
      • unapply

        public abstract List<String> unapply​(@Nullable
                                             String value)
        Provide the reverse mapping from a given value to a list of keys
        Parameters:
        value - the value to apply the reverse lookup
        Returns:
        the list of keys that maps to value or empty list. Note that for the case of a none existing value in the lookup we have to cases either return an empty list OR list with null element. returning an empty list implies that user want to ignore such a lookup value. In the other hand returning a list with the null element implies user want to map the none existing value to the key null. Null value maps to empty list.
      • unapplyAll

        public Map<String,​List<String>> unapplyAll​(Iterable<String> values)
        Parameters:
        values - Iterable of values for which will perform reverse lookup
        Returns:
        Returns Map whose keys are the contents of values and whose values are computed on demand using the reverse lookup function unapply(String) or empty map if values is `null` User can override this method if there is a better way to perform bulk reverse lookup
      • canIterate

        public abstract boolean canIterate()
        Returns true if this lookup extractor's iterable() method will return a valid iterator.
      • canGetKeySet

        public abstract boolean canGetKeySet()
        Returns true if this lookup extractor's keySet() method will return a valid set.
      • getCacheKey

        public abstract byte[] getCacheKey()
        Create a cache key for use in results caching
        Returns:
        A byte array that can be used to uniquely identify if results of a prior lookup can use the cached values
      • isOneToOne

        public boolean isOneToOne()
      • estimateHeapFootprint

        public long estimateHeapFootprint()
        Estimated heap footprint of this object. Not guaranteed to be accurate. For example, some implementations return zero even though they do use on-heap structures. However, the most common class, MapLookupExtractor, does have a reasonable implementation. This API is provided for best-effort memory management and monitoring.