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>>
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds theKey
.comparator
(Comparator<? super E> comparator) Sets theComparator
that can be used to compare the elements.<T> Key.Builder<T,
Value<T>> elementType
(io.leangen.geantyref.TypeToken<T> type) Starter method for the builder, to be used immediately afterKey.builder()
is called.<T> Key.Builder<T,
Value<T>> elementType
(Class<T> type) Starter method for the builder, to be used immediately afterKey.builder()
is called.includesTester
(BiPredicate<? super E, ? super E> predicate) Sets the includes testerBiPredicate
.<T> Key.Builder<List<T>,
ListValue<T>> listElementType
(io.leangen.geantyref.TypeToken<T> type) Starter method for the builder, to be used immediately afterKey.builder()
is called.<T> Key.Builder<List<T>,
ListValue<T>> listElementType
(Class<T> type) Starter method for the builder, to be used immediately afterKey.builder()
is called.<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 afterKey.builder()
is called.<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 afterKey.builder()
is called.<T> Key.Builder<Set<T>,
SetValue<T>> setElementType
(io.leangen.geantyref.TypeToken<T> type) Starter method for the builder, to be used immediately afterKey.builder()
is called.<T> Key.Builder<Set<T>,
SetValue<T>> setElementType
(Class<T> type) Starter method for the builder, to be used immediately afterKey.builder()
is called.<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 afterKey.builder()
is called.<T> Key.Builder<WeightedTable<T>,
WeightedCollectionValue<T>> weightedCollectionElementType
(io.leangen.geantyref.TypeToken<T> type) Starter method for the builder, to be used immediately afterKey.builder()
is called.<T> Key.Builder<WeightedTable<T>,
WeightedCollectionValue<T>> weightedCollectionElementType
(Class<T> type) Starter method for the builder, to be used immediately afterKey.builder()
is called.Methods inherited from interface org.spongepowered.api.util.ResourceKeyedBuilder
key
-
Method Details
-
type
Starter method for the builder, to be used immediately afterKey.builder()
is called. This defines the generics for the builder itself to provide the properly generifiedKey
.For common cases, element types can be specified using one of the
*elementType(Class)
methods. If a newTypeToken
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 KeyB
- The base value type of the key- Parameters:
token
- The type token- Returns:
- This builder, generified
-
elementType
Starter method for the builder, to be used immediately afterKey.builder()
is called. This defines the generics for the builder itself to provide the properly generifiedKey
.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
Starter method for the builder, to be used immediately afterKey.builder()
is called. This defines the generics for the builder itself to provide the properly generifiedKey
.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
Starter method for the builder, to be used immediately afterKey.builder()
is called. This defines the generics for the builder itself to provide the properly generifiedKey
.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
Starter method for the builder, to be used immediately afterKey.builder()
is called. This defines the generics for the builder itself to provide the properly generifiedKey
.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
Starter method for the builder, to be used immediately afterKey.builder()
is called. This defines the generics for the builder itself to provide the properly generifiedKey
.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
Starter method for the builder, to be used immediately afterKey.builder()
is called. This defines the generics for the builder itself to provide the properly generifiedKey
.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
Starter method for the builder, to be used immediately afterKey.builder()
is called. This defines the generics for the builder itself to provide the properly generifiedKey
.This overload is provided for simple cases where a plain
MapValue
is used.- Type Parameters:
K
- The element type of the Key's key typeV
- The element type of the Key's value type- Parameters:
keyType
- the key typevalueType
- the value type- Returns:
- This builder, generified
-
mapElementType
<K,V> Key.Builder<Map<K,V>, mapElementTypeMapValue<K, V>> (io.leangen.geantyref.TypeToken<K> keyType, io.leangen.geantyref.TypeToken<V> valueType) Starter method for the builder, to be used immediately afterKey.builder()
is called. This defines the generics for the builder itself to provide the properly generifiedKey
.This overload is provided for simple cases where a plain
MapValue
is used.- Type Parameters:
K
- The element type of the Key's key typeV
- The element type of the Key's value type- Parameters:
keyType
- the key typevalueType
- 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 afterKey.builder()
is called. This defines the generics for the builder itself to provide the properly generifiedKey
.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 afterKey.builder()
is called. This defines the generics for the builder itself to provide the properly generifiedKey
.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
Sets theComparator
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
Sets the includes testerBiPredicate
. This predicate should returntrue
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
Builds theKey
.- Specified by:
build
in interfaceAbstractBuilder<E>
- Returns:
- The built key
- Throws:
IllegalStateException
- If not all required options were specified;type(TypeToken)
.
-