Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public final class HandlerMethod

  1. Object
  2. HandlerMethod

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.

Constructors

public HandlerMethod(String controllerClass, String methodName, String httpMethod, String pattern)

Methods

public String getControllerClass()The binary name of the controller class, such as com.example.Notes.
public String getMethodName()The name of the handler method.
public String getHttpMethod()The HTTP method the route is mapped to.
public String getPattern()The route template the request matched, such as /notes/{id}; never the concrete path.
public boolean isInPackage(String pkg)Whether the controller class is in pkg or one of its subpackages.
public String toString()Returns a string representation of the object.

Inherited methods

Constructor details

HandlerMethod

public HandlerMethod(String controllerClass, String methodName, String httpMethod, String pattern)

Parameters

controllerClass String
the binary name of the controller class
methodName String
the name of the handler method
httpMethod String
the HTTP method the route is mapped to
pattern String
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 String
a package name, such as com.example.api

Returns

true when the controller is declared there

toString

public String toString()
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())