Annotations
On this page
Using annotions, the developers can specify
- how the request should be processed
- request and response details
- table mapping
The Annotations are used in Handler implementations and Pojo classess. The handlers should be spring Component
CrudMapping
To map a given request to the handler implementation, this annotation is used. The annotated mapping can take arguments similar to spring request mapping and will be available as part of the Tuple.
@Component
@CrudMapping(value = "/v1/agent", type=RemoteAgent.class)
public class RemoteAgentHandler implements QueryHandler{
}
PalmyraType
Specifies the primary table mapping for the given pojo class. In the database, if the naming is maintained as snake_case, the type should be provided as CamelCase.
@Getter
@Setter
@PalmyraType(type="User")
public class User {
}
Note that, the pojo classes are used only for reference and not available in the handler flow.
PalmyraField
By default, all the attributes of the pojo class is assumed be available in the primary class. This annotation is required to add additional meta data such as sorting, searching enabled.
@PalmyraType(type="User")
public class User {
@PalmyraField(attribute="email", sort=true, search=true)
private String loginName;
@PalmyraField(attribute="userName")
private String name;
}
PalmyraIgnore
If any of the field mentioned in the pojo class to be excluded, PalmyraIgnore should be used.