public interface BlockTrait<T extends Comparable<T>> extends CatalogType
BlockTypes BlockState.
A BlockState can include zero or more BlockTraits. Each
BlockTrait within a BlockState is mapped to a value which
represents the current value at the time the BlockState was taken.
For example, a BlockTypes.BED contains three possible
BlockTraits :
If you query a BlockTypes.BED's BlockTrait you have two
possible outcomes for each BlockTrait. The
BooleanTraits.BED_OCCUPIED has the following possible values :
truefalseAs 'OCCUPIED' is a BooleanTrait, it can only be true
or false.
The EnumTraits.BED_PART has the following possible values :
HEADFOOTTo determine the current value of a BlockTrait, you would call
BlockState.getTraitValue(BlockTrait). To determine all possible
values of a BlockTrait, you would call
BlockType.getTraits().
As stated above, a BlockType may not always have one or more
BlockTraits. An example of such a block is
BlockTypes.BOOKSHELF.
| Modifier and Type | Method and Description |
|---|---|
String |
getName()
Gets the name of this
BlockTrait. |
Collection<T> |
getPossibleValues()
Gets all possible values for a specific
BlockTrait. |
Predicate<T> |
getPredicate()
Gets the
Predicate used to determine valid values for this. |
Class<T> |
getValueClass()
Gets the class type of the
BlockTrait's values. |
Optional<T> |
parseValue(String value)
Attempts to parse the provided value as a value dictated possible by this trait or
Optional.empty() otherwise. |
getIdString getName()
BlockTrait.getName in interface CatalogTypeCollection<T> getPossibleValues()
BlockTrait. The
included values may not be in any particular order. The returned
Collection should be considered immutable.Class<T> getValueClass()
BlockTrait's values.Predicate<T> getPredicate()
Predicate used to determine valid values for this.
BlockTrait. Any "value" that returns true when
Predicate.test(Object) is called is valid. The
Predicate is specific to this trait.Optional<T> parseValue(String value)
Optional.empty() otherwise.value - The value to parse