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

All Superinterfaces:
AbstractBuilder<Key<V>>, Builder<Key<V>,Key.Builder<E,V>>, ResettableBuilder<Key<V>,Key.Builder<E,V>>, ResourceKeyedBuilder<Key<V>,Key.Builder<E,V>>
Enclosing interface:
Key<V extends Value<?>>

public static interface Key.Builder<E,V extends Value<E>> extends ResourceKeyedBuilder<Key<V>,Key.Builder<E,V>>
  • Method Details

    • 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(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<List<T>,ListValue<T>> listElementType(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<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<Set<T>,SetValue<T>> setElementType(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<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<Map<K,V>,MapValue<K,V>> mapElementType(Class<K> keyType, 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<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(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(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(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:
    • build

      Key<V> build()
      Builds the Key.
      Specified by:
      build in interface AbstractBuilder<E>
      Returns:
      The built key
      Throws:
      IllegalStateException - If not all required options were specified; type(TypeToken).