Package org.springframework.web
Interface ErrorResponse.Builder
- Enclosing interface:
- ErrorResponse
public static interface ErrorResponse.Builder
Builder for an 
ErrorResponse.- 
Method SummaryModifier and TypeMethodDescriptionbuild()Build theErrorResponseinstance.Set the underlyingProblemDetail.setDetail(String).detailMessageArguments(Object... messageArguments) Set the arguments to provide to theMessageSourcelookup fordetailMessageCode(String).detailMessageCode(String messageCode) Customize theMessageSourcecode for looking up the value for the underlyingdetail(String).Add the given header value(s) under the given name.headers(Consumer<HttpHeaders> headersConsumer) Manipulate this response's headers with the given consumer.Set the underlyingProblemDetail.setInstance(URI)field.Set a "dynamic"propertyon the underlyingProblemDetail.Set the underlyingProblemDetail.setTitle(String)field.titleMessageCode(String messageCode) Customize theMessageSourcecode for looking up the value for the underlyingProblemDetail.setTitle(String).Set the underlyingProblemDetail.setTitle(String)field.
- 
Method Details- 
headerAdd the given header value(s) under the given name.- Parameters:
- headerName- the header name
- headerValues- the header value(s)
- Returns:
- the same builder instance
- See Also:
 
- 
headersManipulate this response's headers with the given consumer. This is useful to overwrite or remove existing values, or use any otherHttpHeadersmethods.- Parameters:
- headersConsumer- a function that consumes the- HttpHeaders
- Returns:
- the same builder instance
 
- 
detailSet the underlyingProblemDetail.setDetail(String).- Returns:
- the same builder instance
 
- 
detailMessageCodeCustomize theMessageSourcecode for looking up the value for the underlyingdetail(String).By default, this is set to ErrorResponse.getDefaultDetailMessageCode(Class, String)with the associated Exception type.- Parameters:
- messageCode- the message code to use
- Returns:
- the same builder instance
- See Also:
 
- 
detailMessageArgumentsSet the arguments to provide to theMessageSourcelookup fordetailMessageCode(String).- Parameters:
- messageArguments- the arguments to provide
- Returns:
- the same builder instance
- See Also:
 
- 
typeSet the underlyingProblemDetail.setTitle(String)field.- Returns:
- the same builder instance
 
- 
titleSet the underlyingProblemDetail.setTitle(String)field.- Returns:
- the same builder instance
 
- 
titleMessageCodeCustomize theMessageSourcecode for looking up the value for the underlyingProblemDetail.setTitle(String).By default, set via ErrorResponse.getDefaultTitleMessageCode(Class)with the associated Exception type.- Parameters:
- messageCode- the message code to use
- Returns:
- the same builder instance
- See Also:
 
- 
instanceSet the underlyingProblemDetail.setInstance(URI)field.- Returns:
- the same builder instance
 
- 
propertySet a "dynamic"propertyon the underlyingProblemDetail.- Returns:
- the same builder instance
 
- 
buildErrorResponse build()Build theErrorResponseinstance.
 
-