@POST
@Path("/{companyid}/location")
public Response addLocationCommand(LocationCommandDto addLocationCommand, @PathParam("companyid") String companyID) throws Throwable{
addLocationCommand.setCompanyId(companyID);
Response response = processApiRequest(addLocationCommand, LocationCommandDtoToAddLocationCommandConverter.class,
AddLocationCommandProcessor.class);
return response;
对象现在我在JSON格式参数转换到REST
{
"locationNam1e": "ytjtjtyj",
"locationType":"new",
"timeZone":"",
"mondayWorkingType":"halfday"
}
现在我LocationCommandDto类包含以下属性发送请求。
public class LocationCommandDto implements CommandDTO {
private String companyId;
private String locationName;
private String locationType;
private String timeZone;
}
现在
在JSON我有属性为“locationNam1e”,这是不正确的,在我的LocationCommandDto是LOCATIONNAME,因此如何将它们映射并抛出异常,如果请求体的参数没有类属性的匹配,我们正在转换??