Class HandlerMethod

java.lang.Object
com.codename1.backend.web.HandlerMethod

public final class HandlerMethod extends Object

The controller method a request was routed to, as interceptors and exception resolvers see it.

The build creates one per route, as a constant of the generated router, so reading it costs nothing per request. It names the method rather than holding a reflective handle: nothing in a translated backend can call a method by name, and nothing here needs to.

  • Constructor Details

    • HandlerMethod

      public HandlerMethod(String controllerClass, String methodName, String httpMethod, String pattern)
      Parameters:
      controllerClass - the binary name of the controller class
      methodName - the name of the handler method
      httpMethod - the HTTP method the route is mapped to
      pattern - the route template, such as /notes/{id}
  • Method Details

    • getControllerClass

      public String getControllerClass()
      The binary name of the controller class, such as com.example.Notes.
    • getMethodName

      public String getMethodName()
      The name of the handler method.
    • getHttpMethod

      public String getHttpMethod()
      The HTTP method the route is mapped to. A GET route also answers HEAD, and reports GET here when it does.
    • getPattern

      public String getPattern()
      The route template the request matched, such as /notes/{id}; never the concrete path.
    • isInPackage

      public boolean isInPackage(String pkg)
      Whether the controller class is in pkg or one of its subpackages.
      Parameters:
      pkg - a package name, such as com.example.api
      Returns:
      true when the controller is declared there
    • toString

      public String toString()
      Description copied from class: Object
      Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
      Overrides:
      toString in class Object