Interface ReferencePath
- All Known Subinterfaces:
CollectionItemReferencePath,MapItemReferencePath,PropertyReferencePath
public sealed interface ReferencePath
permits CollectionItemReferencePath, MapItemReferencePath, PropertyReferencePath
Represents a reference path used for tracking references within serialized or deserialized data structures.
This interface serves as a base for specific types of reference paths such as property references,
collection item references, and map item references.
It allows encapsulating and constructing paths for identifying specific items or properties in complex object graphs, making it useful in serialization and deserialization processes where tracking the location of errors or data modifications is required.
- Since:
- 2.14
- Author:
- Denis Stepanov
-
Method Summary
Modifier and TypeMethodDescriptionio.micronaut.core.type.Argument<?>static ReferencePathofCollection(Class<?> type, io.micronaut.core.type.Argument<?> collectionArgument, int index) Creates a reference path for a specific item within a collection.static ReferencePathCreates a reference path for a specific item within a map.static ReferencePathofProperty(Class<?> beanType, io.micronaut.core.type.Argument<?> property) Creates a reference path for a property of a specified bean type.
-
Method Details
-
ofProperty
Creates a reference path for a property of a specified bean type.- Parameters:
beanType- The class of the bean containing the property.property- The argument representing the property.- Returns:
- A
ReferencePathinstance representing the property reference path.
-
ofCollection
static ReferencePath ofCollection(Class<?> type, io.micronaut.core.type.Argument<?> collectionArgument, int index) Creates a reference path for a specific item within a collection.- Parameters:
type- The class type of the collection.collectionArgument- The collection argument.index- The index of the item within the collection.- Returns:
- A
ReferencePathinstance representing the collection item reference path.
-
ofMap
static ReferencePath ofMap(Class<?> type, io.micronaut.core.type.Argument<?> mapArgument, String key) Creates a reference path for a specific item within a map.- Parameters:
type- The class type of the map.mapArgument- The map argument.key- The key of the item within the map.- Returns:
- A
ReferencePathinstance representing the map item reference path.
-
getArgument
io.micronaut.core.type.Argument<?> getArgument()- Returns:
- The referenced argument
-