Interface StateProperty<T extends java.lang.Comparable<T>>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.Optional<T> parseValue​(java.lang.String value)
      Attempts to parse the provided value as a value dictated possible by this state property or Optional.empty() otherwise.
      java.util.Collection<T> possibleValues()
      Gets all possible values for a specific StateProperty.
      java.util.function.Predicate<T> predicate()
      Gets the Predicate used to determine valid values for this.
      java.lang.Class<T> valueClass()
      Gets the class type of the StateProperty's values.
      • Methods inherited from interface org.spongepowered.api.util.Nameable

        name
    • Method Detail

      • possibleValues

        java.util.Collection<T> possibleValues()
        Gets all possible values for a specific StateProperty. The included values may not be in any particular order. The returned Collection should be considered immutable.
        Returns:
        All possible values
      • valueClass

        java.lang.Class<T> valueClass()
        Gets the class type of the StateProperty's values.
        Returns:
        The value class
      • predicate

        java.util.function.Predicate<T> predicate()
        Gets the Predicate used to determine valid values for this. StateProperty. Any "value" that returns true when Predicate.test(Object) is called is valid. The Predicate is specific to this property.
        Returns:
        The predicate
      • parseValue

        java.util.Optional<T> parseValue​(java.lang.String value)
        Attempts to parse the provided value as a value dictated possible by this state property or Optional.empty() otherwise.
        Parameters:
        value - The value to parse
        Returns:
        The actual value