@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,因此如何將它們映射並拋出異常,如果請求體的參數沒有類屬性的匹配,我們正在轉換??