Package sonia.scm.api.v2.resources
Class HalEnricherContext
java.lang.Object
sonia.scm.api.v2.resources.HalEnricherContext
Context object for the
HalEnricher
. The context holds the source object for the json and all related
objects, which can be useful for the enrichment.- Since:
- 2.0.0
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic HalEnricherContext.Builder
builder()
Return builder forHalEnricherContext
.static HalEnricherContext
Creates a context with the given entries<T> Optional<T>
Returns the registered object from the context.<T> T
oneRequireByType
(Class<T> type) Returns the registered object from the context, but throws anNoSuchElementException
if the type was not registered.
-
Method Details
-
of
Creates a context with the given entries- Parameters:
instances
- entries of the context
-
builder
Return builder forHalEnricherContext
.- Since:
- 2.23.0
-
oneByType
Returns the registered object from the context. The method will return an empty optional, if no object with the given type was registered.- Type Parameters:
T
- type of instance- Parameters:
type
- type of instance- Returns:
- optional instance
-
oneRequireByType
Returns the registered object from the context, but throws anNoSuchElementException
if the type was not registered.- Type Parameters:
T
- type of instance- Parameters:
type
- type of instance- Returns:
- instance
-