Package de.craftsblock.craftsnet.api
Record Class RouteRegistry.EndpointMapping
java.lang.Object
java.lang.Record
de.craftsblock.craftsnet.api.RouteRegistry.EndpointMapping
- Record Components:
priority- TheProcessPriority.Prioritylevel for this endpoint.method- TheMethodassociated with the handler.handler- TheHandlerinstance that owns the method.validator- ThePatternused for validating input related to the endpoint.requirements- A concurrent map of requirements, indexed by their annotation class.
- All Implemented Interfaces:
RouteRegistry.Mapping
- Enclosing class:
- RouteRegistry
public static record RouteRegistry.EndpointMapping(ProcessPriority.Priority priority, @NotNull Method method, @NotNull Handler handler, @NotNull Pattern validator, ConcurrentHashMap<Class<? extends Annotation>,RequirementInfo> requirements, Stack<Middleware> middlewares)
extends Record
implements RouteRegistry.Mapping
Represents the mapping of a registered endpoint handler.
This class stores information about the endpoint's processing priority, the associated handler method, its parent handler, a validation pattern, and any requirement-related metadata.
- Since:
- 3.0.5-SNAPSHOT
-
Constructor Summary
ConstructorsConstructorDescriptionEndpointMapping(ProcessPriority.Priority priority, @NotNull Method method, @NotNull Handler handler, @NotNull Pattern validator, ConcurrentHashMap<Class<? extends Annotation>, RequirementInfo> requirements, Stack<Middleware> middlewares) Creates an instance of aEndpointMappingrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.<A extends Annotation,T>
TgetRequirements(@NotNull Class<A> annotation, @NotNull String key) Retrieves a specific value from the requirements of the given annotation.@NotNull Handlerhandler()Returns the value of thehandlerrecord component.final inthashCode()Returns a hash code value for this object.<A extends Annotation>
booleanChecks whether the given annotation is present in the requirements.<A extends Annotation>
booleanChecks whether a specific key within the given annotation's requirements is present.@NotNull Methodmethod()Returns the value of themethodrecord component.Returns the value of themiddlewaresrecord component.priority()Returns the value of thepriorityrecord component.ConcurrentHashMap<Class<? extends Annotation>,RequirementInfo> Returns the value of therequirementsrecord component.final StringtoString()Returns a string representation of this record class.@NotNull PatternReturns the value of thevalidatorrecord component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface de.craftsblock.craftsnet.api.RouteRegistry.Mapping
getRequirements
-
Constructor Details
-
EndpointMapping
public EndpointMapping(@NotNull ProcessPriority.Priority priority, @NotNull @NotNull Method method, @NotNull @NotNull Handler handler, @NotNull @NotNull Pattern validator, ConcurrentHashMap<Class<? extends Annotation>, RequirementInfo> requirements, Stack<Middleware> middlewares) Creates an instance of aEndpointMappingrecord class.- Parameters:
priority- the value for thepriorityrecord componentmethod- the value for themethodrecord componenthandler- the value for thehandlerrecord componentvalidator- the value for thevalidatorrecord componentrequirements- the value for therequirementsrecord componentmiddlewares- the value for themiddlewaresrecord component
-
-
Method Details
-
isPresent
Checks whether the given annotation is present in the requirements.- Specified by:
isPresentin interfaceRouteRegistry.Mapping- Parameters:
annotation- The annotation class to check for.- Returns:
trueif the annotation is present,falseotherwise.
-
isPresent
public <A extends Annotation> boolean isPresent(@NotNull @NotNull Class<A> annotation, @NotNull @NotNull String key) Checks whether a specific key within the given annotation's requirements is present.- Specified by:
isPresentin interfaceRouteRegistry.Mapping- Parameters:
annotation- The annotation class to check for.key- The specific key to check within the annotation's requirements.- Returns:
trueif the key is present within the annotation's requirements,falseotherwise.
-
getRequirements
public <A extends Annotation,T> T getRequirements(@NotNull @NotNull Class<A> annotation, @NotNull @NotNull String key) Retrieves a specific value from the requirements of the given annotation.- Specified by:
getRequirementsin interfaceRouteRegistry.Mapping- Parameters:
annotation- The annotation class to retrieve the value from.key- The specific key within the annotation's requirements.- Returns:
- The value associated with the given key, or
nullif not present.
-
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). -
priority
Returns the value of thepriorityrecord component.- Returns:
- the value of the
priorityrecord component
-
method
Returns the value of themethodrecord component.- Returns:
- the value of the
methodrecord component
-
handler
Returns the value of thehandlerrecord component.- Returns:
- the value of the
handlerrecord component
-
validator
Returns the value of thevalidatorrecord component.- Returns:
- the value of the
validatorrecord component
-
requirements
Returns the value of therequirementsrecord component.- Returns:
- the value of the
requirementsrecord component
-
middlewares
Returns the value of themiddlewaresrecord component.- Returns:
- the value of the
middlewaresrecord component
-