Interface Key<V extends Value<?>>

    • Method Detail

      • from

        static <V> Key<Value<V>> from​(org.spongepowered.plugin.PluginContainer plugin,
                                      java.lang.String value,
                                      java.lang.Class<V> type)
      • fromList

        static <V> Key<ListValue<V>> fromList​(org.spongepowered.plugin.PluginContainer plugin,
                                              java.lang.String value,
                                              java.lang.Class<V> type)
      • fromSet

        static <V> Key<SetValue<V>> fromSet​(org.spongepowered.plugin.PluginContainer plugin,
                                            java.lang.String value,
                                            java.lang.Class<V> type)
      • fromMap

        static <K,​V> Key<MapValue<K,​V>> fromMap​(org.spongepowered.plugin.PluginContainer plugin,
                                                            java.lang.String value,
                                                            java.lang.Class<K> keyType,
                                                            java.lang.Class<V> valueType)
      • fromMap

        static <K,​V> Key<MapValue<K,​V>> fromMap​(ResourceKey resourceKey,
                                                            java.lang.Class<K> keyType,
                                                            java.lang.Class<V> valueType)
      • valueType

        java.lang.reflect.Type valueType()
        Gets the type of the Value this Key is representing.
        Returns:
        The value generic type
      • elementType

        java.lang.reflect.Type elementType()
        Gets the type of the element of the Value this Key is representing. On occasion, if the element is a Collection type, one can use ParameterizedType.getActualTypeArguments() to access type parameters, such as the element type parameter for List or Map values.
        Returns:
        The element generic type
      • elementComparator

        java.util.Comparator<?> elementComparator()
        Gets the Comparator to compare values of this key.
        Returns:
        The value comparator
      • elementIncludesTester

        java.util.function.BiPredicate<?,​?> elementIncludesTester()
        Gets the includes tester BiPredicate. This predicate should return true when the second parameter (the key value) is included in the first one (the matcher value).

        The default tester will always return false.

        Returns:
        The includes tester bi predicate
        See Also:
        KeyValueMatcher.Operator.INCLUDES, KeyValueMatcher.Operator.EXCLUDES
      • registerEvent

        <E extends DataHolder> void registerEvent​(org.spongepowered.plugin.PluginContainer plugin,
                                                  java.lang.Class<E> holderFilter,
                                                  EventListener<ChangeDataHolderEvent.ValueChange> listener)
        Register an event listener which listens to the value the key accesses changing.
        Type Parameters:
        E - The class type of the data holder
        Parameters:
        holderFilter - The data holder to filter with
        listener - The event listener