PalmyraResponse#

com.palmyralabs.palmyra.base.PalmyraResponse<T>

Overview#

Thin generic wrapper around a handler result. Holds the result value and derives the HTTP status — 200 when a result is present, 404 when it is null. Lombok-generated getters and an all-args constructor.

Methods#

Method Signature
PalmyraResponse PalmyraResponse(T result) (generated)
getResult T getResult() (Lombok-generated)
getStatus int getStatus()200 when result is non-null, 404 otherwise

Example#

@RestController
@RequestMapping("/v1/admin/user")
public class UserLookupController {

    private final UserService service;

    @GetMapping("/{id}")
    public PalmyraResponse<User> byId(@PathVariable String id) {
        return new PalmyraResponse<>(service.findById(id)); // status auto: 200 or 404
    }
}