Record Class TypedKey<T>
java.lang.Object
java.lang.Record
fr.fidorial.registry.TypedKey<T>
- Type Parameters:
T- the type of the entry- Record Components:
registry- the registry the key belongs tokey- the key of the entry
A key bound to the registry it belongs to, so lookups are type-safe.
- Since:
- 0.1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TypedKey<T> create(RegistryKey<T> registry, String key) Returns a key of the given registry.static <T> TypedKey<T> create(RegistryKey<T> registry, Key key) Returns a key of the given registry.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.key()Returns the value of thekeyrecord component.registry()Returns the value of theregistryrecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
TypedKey
Validates the components.
-
-
Method Details
-
create
Returns a key of the given registry.- Type Parameters:
T- the type of the entry- Parameters:
registry- the registrykey- the key of the entry- Returns:
- a key of the given registry
- Since:
- 0.1.0
-
create
Returns a key of the given registry.- Type Parameters:
T- the type of the entry- Parameters:
registry- the registrykey- the key of the entry, for instanceminecraft:stone- Returns:
- a key of the given registry
- Since:
- 0.1.0
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
registry
-
key
-