Class Problem
java.lang.Object
org.springframework.hateoas.mediatype.problem.Problem
- Direct Known Subclasses:
Problem.ExtendedProblem
Encapsulation of an RFC-7807 Problem code. While it complies out-of-the-box, it may also be extended to
support domain-specific details.
- Author:
- Greg Turnquist, Oliver Drotbohm
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Problem
create()
Returns an emptyProblem
instance.static <T> Problem.ExtendedProblem<T>
create
(T payload) Returns anProblem.ExtendedProblem
with the given payload as additional properties.boolean
getTitle()
getType()
int
hashCode()
static Problem
statusOnly
(HttpStatus status) toString()
withDetail
(String detail) Create a newProblem
by copying its attributes and replacing the detail.withInstance
(URI instance) Create a newProblem
by copying its attributes and replacing the instance.withProperties
(Consumer<Map<String, Object>> consumer) Returns anProblem.ExtendedProblem
with aMap<String,
populated by the given consumer as payload.Object> withProperties
(Map<String, Object> properties) Returns anProblem.ExtendedProblem
with the givenMap
unwrapping as additional properties.<T> Problem.ExtendedProblem<T>
withProperties
(T payload) Creates a newProblem.ExtendedProblem
with the given payload as additional properties.withStatus
(HttpStatus status) Create a newProblem
by copying its attributes and replacing the status.Create a newProblem
by copying its attributes and replacing the title.Create a newProblem
by copying its attributes and replacing the type.
-
Constructor Details
-
Problem
-
Problem
protected Problem()
-
-
Method Details
-
create
Returns an emptyProblem
instance.- Returns:
- an empty
Problem
instance.
-
create
Returns anProblem.ExtendedProblem
with the given payload as additional properties.- Type Parameters:
T
-- Parameters:
payload
- must not be null.- Returns:
-
statusOnly
- Parameters:
status
- must not be null.- Returns:
- See Also:
-
withType
Create a newProblem
by copying its attributes and replacing the type.- Parameters:
type
-- Returns:
-
withTitle
Create a newProblem
by copying its attributes and replacing the title.- Parameters:
title
-- Returns:
-
withStatus
Create a newProblem
by copying its attributes and replacing the status.- Parameters:
status
-- Returns:
-
withDetail
Create a newProblem
by copying its attributes and replacing the detail.- Parameters:
detail
-- Returns:
-
withInstance
Create a newProblem
by copying its attributes and replacing the instance.- Parameters:
instance
-- Returns:
-
withProperties
Creates a newProblem.ExtendedProblem
with the given payload as additional properties.- Type Parameters:
T
-- Parameters:
payload
- must not be null.- Returns:
-
withProperties
public Problem.ExtendedProblem<Map<String,Object>> withProperties(Consumer<Map<String, Object>> consumer) Returns anProblem.ExtendedProblem
with aMap<String,
populated by the given consumer as payload.Object> - Parameters:
consumer
- must not be null.- Returns:
-
withProperties
Returns anProblem.ExtendedProblem
with the givenMap
unwrapping as additional properties.- Parameters:
properties
- must not be null.- Returns:
-
getType
-
getTitle
-
getStatus
-
getDetail
-
getInstance
-
equals
-
hashCode
public int hashCode() -
toString
-