Record Class PermissionDynamicContextKey<T>
java.lang.Object
java.lang.Record
net.neoforged.neoforge.server.permission.nodes.PermissionDynamicContextKey<T>
public record PermissionDynamicContextKey<T>(Class<T> typeToken, String name, Function<T,String> serializer)
extends Record
Represents a key that can be used to build a
PermissionDynamicContext
.
Keys, along with their associated values, can be used to provide additional context for a permission handler in determining whether to grant permission for an actor and a specific node.
As an example usage, a dimension context key could be used inside a building permission check to ensure that the actor can build given those constraints.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateContext
(T value) final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.name()
Returns the value of thename
record component.Returns the value of theserializer
record component.final String
toString()
Returns a string representation of this record class.Returns the value of thetypeToken
record component.
-
Field Details
-
typeToken
The field for thetypeToken
record component. -
name
The field for thename
record component. -
serializer
The field for theserializer
record component.
-
-
Constructor Details
-
PermissionDynamicContextKey
Creates an instance of aPermissionDynamicContextKey
record class.- Parameters:
typeToken
- the value for thetypeToken
record componentname
- the value for thename
record componentserializer
- the value for theserializer
record component
-
-
Method Details
-
createContext
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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)
. -
typeToken
Returns the value of thetypeToken
record component.- Returns:
- the value of the
typeToken
record component
-
name
Returns the value of thename
record component.- Returns:
- the value of the
name
record component
-
serializer
Returns the value of theserializer
record component.- Returns:
- the value of the
serializer
record component
-