Klasse HalEmbeddedWrapper<EmbeddedT>
- Typparameter:
EmbeddedT- the type of the objects being wrapped, which represent embedded resources related to the main data
HalResourceWrapper and HalListWrapper by focusing
specifically on the management of embedded resources associated with the main resource.
The HalEmbeddedWrapper is a final class and is not intended for extension. It is designed to hold an
instance of EmbeddedT, representing embedded resources that provide additional context or related data to
the
primary resource. This wrapper ensures that embedded resources are correctly serialized within their designated
namespace in the output structure.
Instantiation of this class is usually not required by hand, as the many embed method HalResourceWrapper and
HalListWrapper do this automatically (e.g.
HalResourceWrapper.withEmbeddedResource(HalEmbeddedWrapper).
-
Feldübersicht
Von Klasse geerbte Felder de.kamillionlabs.hateoflux.model.hal.HalWrapper
links -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic <EmbeddedT>
HalEmbeddedWrapper<EmbeddedT> empty()Creates an empty instance.booleanisEmpty()Indicates whether the wrapper holds a resource.static <EmbeddedT>
HalEmbeddedWrapper<EmbeddedT> wrap(EmbeddedT resourceToWrap) Wrapper for any given resource that is desired to be put as an embedded resource in either aHalListWrapperor aHalResourceWrapper, ensuring it conforms to HAL standards.Von Klasse geerbte Methoden de.kamillionlabs.hateoflux.model.hal.HalWrapper
add, add, determineCollectionRelationName, determineRelationNameForObject, determineResourceRelationName, getLink, getLink, getLinks, getRequiredLink, getRequiredLink, isScalar, withLinks, withLinks
-
Methodendetails
-
isEmpty
public boolean isEmpty()Indicates whether the wrapper holds a resource.- Gibt zurück:
trueif the wrapper holds no resource;falseotherwise
-
empty
Creates an empty instance.- Typparameter:
EmbeddedT- Type of the embedded resource- Gibt zurück:
- the created empty instance
-
wrap
Wrapper for any given resource that is desired to be put as an embedded resource in either aHalListWrapperor aHalResourceWrapper, ensuring it conforms to HAL standards. When serialized, the resource is placed into the_embeddednode.To comply with HAL,
EmbeddedTmust not be a collection or iterable. This enforcement helps maintain the rule that collections ofHalEmbeddedWrapperare created, rather than a single wrapper containing multiple resources.Hint:
Be aware that manual wrapping of an embedded resource is not required. When using awithEmbeddedXYZ()method fromHalResourceWrapperorHalListWrapper, the wrapping of the embedded resource is automatically handled by these methods.- Typparameter:
EmbeddedT- the type of the resource to be wrapped- Parameter:
resourceToWrap- the object to wrap- Gibt zurück:
- a new instance containing the wrapped resource
- Löst aus:
IllegalArgumentException- ifresourceToWrapis an iterable
-