Class InstancesDiff.InstanceCollection
- java.lang.Object
-
- org.apache.sling.discovery.commons.InstancesDiff.InstanceCollection
-
- Enclosing class:
- InstancesDiff
public final class InstancesDiff.InstanceCollection extends java.lang.ObjectTheInstanceCollectioncollection allows to filter the instances using a set of custom filter either implementingInstanceFilteror pre-defined ones.Filters conditions are joined combined together using the logical operator "AND".
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InstancesDiff.InstanceCollectionfilterWith(InstanceFilter filter)Filter the instances with a customInstanceFilterfilter.java.util.Collection<InstanceDescription>get()Return the collection ofInstanceDescriptioninstances that have not been filtered out.InstancesDiff.InstanceCollectionisInClusterView(ClusterView clusterView)Keep only the instances that are contained in the sameClusterViewcluster view as the one provided.InstancesDiff.InstanceCollectionisLeader()Keep only the leader instances (seeInstanceDescription.isLeader().InstancesDiff.InstanceCollectionisLocal()Keep only the local instance (seeInstanceDescription.isLocal().InstancesDiff.InstanceCollectionisNotInClusterView(ClusterView clusterView)Filter out the instances that are contained in the sameClusterViewcluster view as the one provided.InstancesDiff.InstanceCollectionisNotLeader()Filter out the leader instances (seeInstanceDescription.isLeader().InstancesDiff.InstanceCollectionisNotLocal()Filter out the local instances (seeInstanceDescription.isLocal().
-
-
-
Method Detail
-
filterWith
@Nonnull public InstancesDiff.InstanceCollection filterWith(@Nullable InstanceFilter filter)
Filter the instances with a customInstanceFilterfilter.- Parameters:
filter- the filter to be applied on the instances- Returns:
this
-
isLocal
@Nonnull public InstancesDiff.InstanceCollection isLocal()
Keep only the local instance (seeInstanceDescription.isLocal().- Returns:
this
-
isNotLocal
@Nonnull public InstancesDiff.InstanceCollection isNotLocal()
Filter out the local instances (seeInstanceDescription.isLocal().- Returns:
this
-
isLeader
@Nonnull public InstancesDiff.InstanceCollection isLeader()
Keep only the leader instances (seeInstanceDescription.isLeader().- Returns:
this
-
isNotLeader
@Nonnull public InstancesDiff.InstanceCollection isNotLeader()
Filter out the leader instances (seeInstanceDescription.isLeader().- Returns:
this
-
isInClusterView
@Nonnull public InstancesDiff.InstanceCollection isInClusterView(@Nullable ClusterView clusterView)
Keep only the instances that are contained in the sameClusterViewcluster view as the one provided.The comparison between cluster views is done on the basis of the cluster view identifier. Two cluster views with the same identifier are considered equal.
- Parameters:
clusterView- the cluster view used to filter the instances- Returns:
this
-
isNotInClusterView
@Nonnull public InstancesDiff.InstanceCollection isNotInClusterView(@Nullable ClusterView clusterView)
Filter out the instances that are contained in the sameClusterViewcluster view as the one provided.The comparison between cluster views is done on the basis of the cluster view identifier. Two cluster views with the same identifier are considered equal.
- Parameters:
clusterView- the cluster view used to filter the instances- Returns:
this
-
get
@Nonnull public java.util.Collection<InstanceDescription> get()
Return the collection ofInstanceDescriptioninstances that have not been filtered out.- Returns:
- the filtered collection of instances.
-
-