Class MapLookupExtractor

    • Constructor Detail

      • MapLookupExtractor

        public MapLookupExtractor​(Map<String,​String> map,
                                  boolean isOneToOne)
    • Method Detail

      • estimateHeapFootprint

        public static <K,​V> long estimateHeapFootprint​(@Nullable
                                                             Map<K,​V> map)
        Estimate the heap footprint of a Map. Important note: the implementation accepts any kind of Map, but estimates zero footprint for keys and values of types other than String.
      • apply

        @Nullable
        public String apply​(@Nullable
                            String key)
        Description copied from class: LookupExtractor
        Apply a particular lookup methodology to the input string
        Specified by:
        apply in class LookupExtractor
        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.
      • unapply

        public List<String> unapply​(@Nullable
                                    String value)
        Description copied from class: LookupExtractor
        Provide the reverse mapping from a given value to a list of keys
        Specified by:
        unapply in class LookupExtractor
        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.
      • getCacheKey

        public byte[] getCacheKey()
        Description copied from class: LookupExtractor
        Create a cache key for use in results caching
        Specified by:
        getCacheKey in class LookupExtractor
        Returns:
        A byte array that can be used to uniquely identify if results of a prior lookup can use the cached values
      • estimateHeapFootprint

        public long estimateHeapFootprint()
        Description copied from class: LookupExtractor
        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.
        Overrides:
        estimateHeapFootprint in class LookupExtractor
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object