Package me.croabeast.file
Interface UnitMappable<U extends ConfigurableUnit,C extends Collection<U>,UM extends UnitMappable<U,C,UM>>
- Type Parameters:
U- The type of configurable unit stored.C- The type of collection that holds the configurable units.UM- The type of the implementingUnitMappableinstance.
- All Superinterfaces:
BaseBuilder<UM>,Copyable<UM>,Iterable<Map.Entry<Integer,,C>> Map<Integer,,C> Mappable<U,C, UM>
- All Known Subinterfaces:
UnitMappable.List<U>,UnitMappable.Set<U>
public interface UnitMappable<U extends ConfigurableUnit,C extends Collection<U>,UM extends UnitMappable<U,C,UM>>
extends Mappable<U,C,UM>
Represents a mappable collection of configurable units.
UnitMappable extends Mappable to provide a specialized mapping where integer keys
are associated with collections of ConfigurableUnit objects. It adds factory methods for
creating new instances with specific backing collection types and supports operations such as merging
values from multiple keys.
Important: For full functionality, you must implement the base UnitMappable interface.
However, its nested sub-interfaces UnitMappable.Set and UnitMappable.List are designed
to be directly instantiated using the provided static factory methods asSet(Map) and asList(Map),
which return ready-to-use implementations.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceUnitMappable.List<U extends ConfigurableUnit>A sub-interface ofUnitMappablespecialized for list-backed collections.static interfaceUnitMappable.Set<U extends ConfigurableUnit>A sub-interface ofUnitMappablespecialized for set-backed collections.Nested classes/interfaces inherited from interface me.croabeast.file.Mappable
Mappable.BaseList<T,B extends Mappable.BaseList<T, B>>, Mappable.BaseSet<T, B extends Mappable.BaseSet<T, B>> -
Method Summary
Modifier and TypeMethodDescriptionstatic <U extends ConfigurableUnit>
UnitMappable.List<U> asList()Creates an emptyUnitMappable.Listinstance.static <U extends ConfigurableUnit>
UnitMappable.List<U> Creates a newUnitMappable.Listinstance from the given map.static <U extends ConfigurableUnit>
UnitMappable.Set<U> asSet()Creates an emptyUnitMappable.Setinstance.static <U extends ConfigurableUnit>
UnitMappable.Set<U> Creates a newUnitMappable.Setinstance from the given map.default UgetUnit(@Nullable org.bukkit.entity.Player player) Methods inherited from interface me.croabeast.common.builder.BaseBuilder
instanceMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesMethods inherited from interface me.croabeast.file.Mappable
filter, getStoredValues, getStoredValues, iterator, order, order
-
Method Details
-
getUnit
-
asSet
Creates a newUnitMappable.Setinstance from the given map.- Type Parameters:
U- the type of configurable unit.- Parameters:
map- the map containing integer keys mapping to sets ofConfigurableUnitobjects.- Returns:
- a new
UnitMappable.Setinstance populated with the provided map.
-
asSet
Creates an emptyUnitMappable.Setinstance.- Type Parameters:
U- the type of configurable unit.- Returns:
- a new empty
UnitMappable.Setinstance.
-
asList
Creates a newUnitMappable.Listinstance from the given map.- Type Parameters:
U- the type of configurable unit.- Parameters:
map- the map containing integer keys mapping to lists ofConfigurableUnitobjects.- Returns:
- a new
UnitMappable.Listinstance populated with the provided map.
-
asList
Creates an emptyUnitMappable.Listinstance.- Type Parameters:
U- the type of configurable unit.- Returns:
- a new empty
UnitMappable.Listinstance.
-