Interface ReferencePath
-
public interface ReferencePathRepresents a reference path from one item to another as a sequence of some Java property or attribute invocation. For example, let's say we haveAddresstype, with attributesowner, which is aCustomer; theCustomerhas attributeorganization, which is aCompany. Then a path that containsownerandorganizationattributes would lead us from a specific instance ofAddressto the corresponding instance ofCompany.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Collection<java.lang.Object>execute(ItemModel item)Performs navigation to the referenced item(s) by following this reference path.java.util.Collection<ReferencePath>expand()Expands current path into all possible references from the current destination in this path to other integration items.TypeDescriptorgetDestination()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.
-
-
-
Method Detail
-
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
boolean reaches(TypeDescriptor type)
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
java.util.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:
getDestination()
-
execute
java.util.Collection<java.lang.Object> execute(ItemModel item)
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.
-
-