Interface Key.Builder<E,​V extends Value<E>>

    • Method Detail

      • type

        <T,​B extends Value<T>> Key.Builder<T,​B> type​(io.leangen.geantyref.TypeToken<B> token)
        Starter method for the builder, to be used immediately after Key.builder() is called. This defines the generics for the builder itself to provide the properly generified Key.

        For common cases, element types can be specified using one of the *elementType(Class) methods. If a new TypeToken is to be created, it is recommended to create an anonymous class instance of a token, as described in the GeAnTyRef documentation

        Type Parameters:
        T - The element type of the Key
        B - The base value type of the key
        Parameters:
        token - The type token
        Returns:
        This builder, generified
      • elementType

        <T> Key.Builder<T,​Value<T>> elementType​(java.lang.Class<T> type)
        Starter method for the builder, to be used immediately after Key.builder() is called. This defines the generics for the builder itself to provide the properly generified Key.

        This overload is provided for simple cases where a plain Value is used.

        Type Parameters:
        T - The element type of the Key
        Parameters:
        type - The element type
        Returns:
        This builder, generified
      • elementType

        <T> Key.Builder<T,​Value<T>> elementType​(io.leangen.geantyref.TypeToken<T> type)
        Starter method for the builder, to be used immediately after Key.builder() is called. This defines the generics for the builder itself to provide the properly generified Key.

        This overload is provided for simple cases where a plain Value is used.

        Type Parameters:
        T - The element type of the Key
        Parameters:
        type - The element type
        Returns:
        This builder, generified
      • listElementType

        <T> Key.Builder<java.util.List<T>,​ListValue<T>> listElementType​(java.lang.Class<T> type)
        Starter method for the builder, to be used immediately after Key.builder() is called. This defines the generics for the builder itself to provide the properly generified Key.

        This overload is provided for simple cases where a plain ListValue is used.

        Type Parameters:
        T - The element type of the Key
        Parameters:
        type - The element type
        Returns:
        This builder, generified
      • listElementType

        <T> Key.Builder<java.util.List<T>,​ListValue<T>> listElementType​(io.leangen.geantyref.TypeToken<T> type)
        Starter method for the builder, to be used immediately after Key.builder() is called. This defines the generics for the builder itself to provide the properly generified Key.

        This overload is provided for simple cases where a plain ListValue is used.

        Type Parameters:
        T - The element type of the Key
        Parameters:
        type - The element type
        Returns:
        This builder, generified
      • setElementType

        <T> Key.Builder<java.util.Set<T>,​SetValue<T>> setElementType​(java.lang.Class<T> type)
        Starter method for the builder, to be used immediately after Key.builder() is called. This defines the generics for the builder itself to provide the properly generified Key.

        This overload is provided for simple cases where a plain SetValue is used.

        Type Parameters:
        T - The element type of the Key
        Parameters:
        type - The element type
        Returns:
        This builder, generified
      • setElementType

        <T> Key.Builder<java.util.Set<T>,​SetValue<T>> setElementType​(io.leangen.geantyref.TypeToken<T> type)
        Starter method for the builder, to be used immediately after Key.builder() is called. This defines the generics for the builder itself to provide the properly generified Key.

        This overload is provided for simple cases where a plain SetValue is used.

        Type Parameters:
        T - The element type of the Key
        Parameters:
        type - The element type
        Returns:
        This builder, generified
      • mapElementType

        <K,​V> Key.Builder<java.util.Map<K,​V>,​MapValue<K,​V>> mapElementType​(java.lang.Class<K> keyType,
                                                                                                   java.lang.Class<V> valueType)
        Starter method for the builder, to be used immediately after Key.builder() is called. This defines the generics for the builder itself to provide the properly generified Key.

        This overload is provided for simple cases where a plain MapValue is used.

        Type Parameters:
        K - The element type of the Key's key type
        V - The element type of the Key's value type
        Parameters:
        keyType - the key type
        valueType - the value type
        Returns:
        This builder, generified
      • mapElementType

        <K,​V> Key.Builder<java.util.Map<K,​V>,​MapValue<K,​V>> mapElementType​(io.leangen.geantyref.TypeToken<K> keyType,
                                                                                                   io.leangen.geantyref.TypeToken<V> valueType)
        Starter method for the builder, to be used immediately after Key.builder() is called. This defines the generics for the builder itself to provide the properly generified Key.

        This overload is provided for simple cases where a plain MapValue is used.

        Type Parameters:
        K - The element type of the Key's key type
        V - The element type of the Key's value type
        Parameters:
        keyType - the key type
        valueType - the value type
        Returns:
        This builder, generified
      • weightedCollectionElementType

        <T> Key.Builder<WeightedTable<T>,​WeightedCollectionValue<T>> weightedCollectionElementType​(java.lang.Class<T> type)
        Starter method for the builder, to be used immediately after Key.builder() is called. This defines the generics for the builder itself to provide the properly generified Key.

        This overload is provided for simple cases where a plain WeightedCollectionValue is used.

        Type Parameters:
        T - The element type of the Key
        Parameters:
        type - The element type
        Returns:
        This builder, generified
      • weightedCollectionElementType

        <T> Key.Builder<WeightedTable<T>,​WeightedCollectionValue<T>> weightedCollectionElementType​(io.leangen.geantyref.TypeToken<T> type)
        Starter method for the builder, to be used immediately after Key.builder() is called. This defines the generics for the builder itself to provide the properly generified Key.

        This overload is provided for simple cases where a plain WeightedCollectionValue is used.

        Type Parameters:
        T - The element type of the Key
        Parameters:
        type - The element type
        Returns:
        This builder, generified
      • comparator

        Key.Builder<E,​V> comparator​(java.util.Comparator<? super E> comparator)
        Sets the Comparator that can be used to compare the elements.

        Setting the comparator is a requirement if the element type isn't Comparable.

        Parameters:
        comparator - The comparator
        Returns:
        This builder, for chaining
      • includesTester

        Key.Builder<E,​V> includesTester​(java.util.function.BiPredicate<? super E,​? super E> predicate)
        Sets the includes tester BiPredicate. This predicate should return true when the second parameter is included in the first one.

        The default tester will always return false.

        Parameters:
        predicate - The tester bi predicate
        Returns:
        This builder, for chaining
        See Also:
        KeyValueMatcher.Operator.INCLUDES, KeyValueMatcher.Operator.EXCLUDES