Interface StateProperty<T extends java.lang.Comparable<T>>
- 
- All Superinterfaces:
- Nameable
 - All Known Subinterfaces:
- BooleanStateProperty,- EnumStateProperty<E>,- IntegerStateProperty
 
 public interface StateProperty<T extends java.lang.Comparable<T>> extends Nameable Represents a possible state property in aStateContainersState.A Statecan include zero or moreStatePropertys. EachStatePropertywithin aStateis mapped to a value which represents the current value at the time theStatewas taken.For example, a BlockTypes.RED_BEDcontains three possibleStatePropertys :- EnumStateProperties.RED_BED_FACING
- BooleanStateProperties.RED_BED_OCCUPIED
- EnumStateProperties.RED_BED_PART
 If you query a BlockTypes.RED_BED'sStatePropertyyou have two possible outcomes for eachStateProperty. TheBooleanStateProperties.RED_BED_OCCUPIEDhas the following possible values:- true
- false
 As 'OCCUPIED' is a BooleanStateProperty, it can only betrueorfalse. TheEnumStateProperties.RED_BED_PARThas the following possible values:- HEAD
- FOOT
 To determine the current value of a StateProperty, you would callState.stateProperty(StateProperty). To determine all possible values of aStateProperty, you would callState.stateProperties().As stated above, a StateContainermay not always have one or moreStatePropertys. An example of such a block isBlockTypes.BOOKSHELF.
- 
- 
Method SummaryAll 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 orOptional.empty()otherwise.java.util.Collection<T>possibleValues()Gets all possible values for a specificStateProperty.java.util.function.Predicate<T>predicate()Gets thePredicateused to determine valid values for this.java.lang.Class<T>valueClass()Gets the class type of theStateProperty's values.
 
- 
- 
- 
Method Detail- 
possibleValuesjava.util.Collection<T> possibleValues() Gets all possible values for a specificStateProperty. The included values may not be in any particular order. The returnedCollectionshould be considered immutable.- Returns:
- All possible values
 
 - 
valueClassjava.lang.Class<T> valueClass() Gets the class type of theStateProperty's values.- Returns:
- The value class
 
 - 
predicatejava.util.function.Predicate<T> predicate() Gets thePredicateused to determine valid values for this.StateProperty. Any "value" that returnstruewhenPredicate.test(Object)is called is valid. ThePredicateis specific to this property.- Returns:
- The predicate
 
 - 
parseValuejava.util.Optional<T> parseValue(java.lang.String value) Attempts to parse the provided value as a value dictated possible by this state property orOptional.empty()otherwise.- Parameters:
- value- The value to parse
- Returns:
- The actual value
 
 
- 
 
-