Interface ReferencePath
public interface ReferencePath
Represents a reference path from one item to another as a sequence of some Java property or attribute invocation.
For example, let's say we have
Address type, with attributes owner, which is a Customer;
the Customer has attribute organization, which is a Company. Then a path that contains owner and
organization attributes would lead us from a specific instance of Address to the corresponding instance of
Company.-
Method Summary
Modifier and TypeMethodDescriptionPerforms navigation to the referenced item(s) by following this reference path.expand()Expands current path into all possible references from the current destination in this path to other integration items.Retrieves destination type for this path.intlength()Determines how many attributes need to be called in the navigation process until the destination item is reached.booleanreaches(TypeDescriptor type) Determines whether this path navigates through the specified integration item type.Presents this path as conventional Java Bean property path, in which sequence accessor property calls is separated by "." and each next property in the sequence is called on the result of the previous property invocation.
This is purely a presentation of the path and does not guarantee to work when applied to a Java Bean.
-
Method Details
-
getDestination
TypeDescriptor getDestination()Retrieves destination type for this path.- Returns:
- destination type of this navigation path
-
length
int length()Determines how many attributes need to be called in the navigation process until the destination item is reached.- Returns:
- number of attribute calls chained to form this path. 0 means no attribute invocation is involved and the
source
TypeDescriptormatches the destinationTypeDescriptor
-
reaches
Determines whether this path navigates through the specified integration item type.- Parameters:
type- integration item type to check- Returns:
true, if this path has the specified item type as its source or its destination or it's present anywhere in between the source and destination;false, if this path does not navigate through the specified type at all.
-
expand
Collection<ReferencePath> expand()Expands current path into all possible references from the current destination in this path to other integration items. For example, let's say current path contains navigation fromCategorytoProductandProducthas references toUnitandCatalogVersion, then the result of the expansion will contain two paths:- Category -> Product -> Unit
- Category -> Product -> CatalogVersion
- Returns:
- a collection of all paths expanded from the destination. If the destination references itself as possible
navigation, this reference will be excluded from the result. For example, if a
Categoryhas a property/attribute that references anotherCategoryitem instance, e.g. itssupercategory, this navigation fromCategorytoCategoryis excluded. Moreover, the navigation is excluded, if it forms a loop in the path. For example, current path contains navigation fromCategorytoProduct. If product has navigation back to theCategoryor one of its predecessors such reference from theProductwill be ignored and not expanded. If the destination in this path does not have references to other integration items, then it cannot be expanded and therefore an emptyCollectionis returned. - See Also:
-
execute
Performs navigation to the referenced item(s) by following this reference path.- Parameters:
item- an item to resolve attribute references from.- Returns:
- a collection of the items or values referenced by this path from the specified item. The collection contains multiple
elements, if some reference along the path resolves to a collection of values. For example, first attribute in this path
resolves to a collection of items
[a1, a2], then next attribute in this path resolves to[b11, b12]values fora1and to[b21, b22]fora2. The resulting collection will contain values of[b11, b12, b21, b22]. If this path does not resolve to collections along the way, then the resulting collection will have only one element of the destination type. If this path resolves tonullsomewhere along the way, then the resulting collection is empty.
-
toPropertyPath
String toPropertyPath()Presents this path as conventional Java Bean property path, in which sequence accessor property calls is separated by "." and each next property in the sequence is called on the result of the previous property invocation.
This is purely a presentation of the path and does not guarantee to work when applied to a Java Bean. That is, the path may not check for possiblenullvalues of some properties in the middle of the path, existence of indexed properties, etc.- Returns:
- conventional property path presentation of this property path. If this path is empty, an empty string is returned;
otherwise a Java Bean property path, e.g.
"catalogVersion.catalog.id".
-