Annotation Interface BodyTypeSelector


@Retention(RUNTIME) @Target(METHOD) public @interface BodyTypeSelector
This annotation specifies that this particular method needs a body type selector for determining the type that the body needs to convert to. Payload bodies are usually fixed. However, for some generic interfaces payload body could only be determined by knowing the full context of the request. We may have to examine headers, type of object that will be updated etc.

E.g., Let us say we have two subclasses of the Employee class called ContractEmployee and PayrollEmployee. Consider a method that needs to update Employee information such as


   public Employee save(Employee employee);
 

The type of employee that needs to be passed depends on the context. This context can only be determined by examining the request context. For example, the request may have a header which specifies the type of employee who needs to be "saved". The bodyTypeSelector helps in determining the specific type of Employee by examining the context of the request. It has the full context of the request since it is passed a ChenileExchange

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
     
  • Element Details