class ErrorHandler {

	@SuppressWarnings("unchecked")
	public ResponseEntity<?> getMissingParameterErrorResponse(BindingResult bindingResults, RequestInfo requestInfo) {

		Error error = new Error();
		// Setting Error
		error.setCode(400);
		@SuppressWarnings("rawtypes")
		List fieldErrorsList = new ArrayList();
		if (bindingResults.hasFieldErrors()) {
			for (FieldError fieldError : bindingResults.getFieldErrors()) {
				fieldErrorsList.add(fieldError.getField());
			}
		}
		error.setMessage(fieldErrorsList + " : Required Query Parameter Missing ");
		error.setDescription("Error While Binding Results");
		error.setFields(fieldErrorsList);

		ResponseInfo responseInfo = new ResponseInfo();
		// Setting ResponseInfo
		responseInfo.setApiId(requestInfo.getApiId());
		//responseInfo.setKey(requestInfo.getKey());
		responseInfo.setResMsgId(requestInfo.getMsgId());
		responseInfo.setStatus(HttpStatus.BAD_REQUEST.toString());
		//responseInfo.setTenantId(requestInfo.getTenantId());
		responseInfo.setTs(requestInfo.getTs());
		responseInfo.setVer(requestInfo.getVer());

		ErrorResponse errRes = new ErrorResponse();
		// Setting ErrorResponse
		errRes.setError(error);
		errRes.setResponseInfo(responseInfo);

		return new ResponseEntity<ErrorResponse>(errRes, HttpStatus.BAD_REQUEST);
	}

}