java.lang.Object
de.craftsblock.craftsnet.api.requirements.Requirement<T,R>
Type Parameters:
T - The type of the storage class that this requirement gets its data from.
R - The type of the route mapping class that this requirement uses.
Direct Known Subclasses:
WebRequirement, WebSocketRequirement

public abstract class Requirement<T extends RequireAble,R extends RouteRegistry.EndpointMapping> extends Object
Represents an abstract requirement that can be used in the requirement system.
Since:
3.0.5-SNAPSHOT
  • Constructor Details

    • Requirement

      public Requirement(Class<? extends Annotation> annotation)
      Constructs a new requirement with the specified annotation class. The annotation will be used to determine the requirement on the methods of endpoints.
      Parameters:
      annotation - the annotation class that this requirement is associated with.
  • Method Details

    • applies

      public abstract boolean applies(T t, R r)
      Determines if this requirement applies to the specified mapping and content.
      Parameters:
      t - the storage instance
      r - the route mapping instance
      Returns:
      true if the requirement applies, false otherwise
    • getAnnotation

      public Class<? extends Annotation> getAnnotation()
      Gets the annotation class that this requirement is associated with.
      Returns:
      the annotation class