Class CalculatedValueIndexer

  • All Implemented Interfaces:
    Indexer

    @Beta
    public class CalculatedValueIndexer
    extends java.lang.Object
    implements Indexer
    An Indexer that is using a Function to calculate the value for a single Index.
    • Constructor Detail

      • CalculatedValueIndexer

        public CalculatedValueIndexer​(@Nonnull
                                      Index index,
                                      @Nonnull
                                      java.util.function.Function<MessageStoreEntry,​java.lang.String> calculator)
        Creates a CalculatedValueIndexer.
        Parameters:
        index - the Index that is calculated by the calculator function
        calculator - the function that is used to calculate the value for the index
    • Method Detail

      • getIndexes

        @Nonnull
        public com.google.common.collect.ImmutableSet<Index> getIndexes()
        Description copied from interface: Indexer
        Returns the indexes supported by this Indexer.
        Specified by:
        getIndexes in interface Indexer
        Returns:
        Set of Index instances
      • supports

        public boolean supports​(@Nonnull
                                Index index)
        Specified by:
        supports in interface Indexer
        Parameters:
        index - the Index
        Returns:
        true, if the Index is supported, false otherwise.
      • calc

        public java.lang.String calc​(@Nonnull
                                     Index index,
                                     @Nonnull
                                     MessageStoreEntry entry)
        Description copied from interface: Indexer
        Calculates the Index value from the message-store entry.
        Specified by:
        calc in interface Indexer
        Parameters:
        index - the Index
        entry - the MessageStoreEntry
        Returns:
        indexed value