Package com.atlassian.bamboo.utils
Class BambooPredicates
java.lang.Object
com.atlassian.bamboo.utils.BambooPredicates
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> com.google.common.base.Predicate<Iterable<? extends T>>
any
(@NotNull com.google.common.base.Predicate<T> predicate) static com.google.common.base.Predicate<Artifact>
artifactHasName
(@NotNull String artifactName) static com.google.common.base.Predicate<ArtifactLink>
artifactLinkHasArtifactWithName
(@NotNull String artifactName) static com.google.common.base.Predicate<Capability>
capabilityKeyStartsWith
(@NotNull String prefix) Get a predicate that returns true forCapability
which key starts with given prefixstatic <A,
B> Predicate<A> Predicate composestatic @NotNull com.google.common.base.Predicate<PlanDependency>
static @NotNull com.google.common.base.Predicate<PlanDependency>
static @NotNull com.google.common.base.Predicate<PlanDependency>
static <T,
K> Predicate<T> Java Streams API is missing Stream#distinct(keyProvider), this is here to fill that gapstatic @NotNull com.google.common.base.Predicate<ElasticInstanceSchedule>
static com.google.common.base.Predicate<BambooIdProvider>
hasBambooObjectEqualId
(long id) static com.google.common.base.Predicate<BambooIdProvider>
hasBambooObjectEqualId
(@NotNull BambooIdProvider bambooObject) static com.google.common.base.Predicate<TitleProvider>
hasEqualTitle
(String title) static Predicate<NotificationRule>
hasNotificationRuleRecipient
(@NotNull String recipient) static Predicate<NotificationRule>
hasNotificationRuleRecipientType
(@NotNull String recipientType) static com.google.common.base.Predicate<TaskDefinition>
hasTaskDefinitionEqualId
(long id) static boolean
hasTestCases
(@NotNull TestClassResult testClassResult) static com.google.common.base.Predicate<ImmutableArtifactDefinitionBase>
static <T> @NotNull com.google.common.base.Predicate<? super Class<? extends T>>
isAssignableFrom
(Class clazz) static Predicate<PlanRepositoryDefinition>
isChainTrigger
(@NotNull ImmutableChain chain, @Nullable Set<Long> triggeringRepositories) static com.google.common.base.Predicate<TaskDefinition>
Get a predicate that returns true for TaskDefinition which are marked as "finalizing"static boolean
isNotDeleted
(ImmutableDeletable deletable) static com.google.common.base.Predicate<TaskResult>
isTaskResultPluginKeyEqual
(@NotNull String pluginKey) Get a predicate that returns true forTaskResult
whichTaskDefinition
has equal pluginKeystatic @NotNull com.google.common.base.Predicate<Labelling>
labelNameIn
(@NotNull Iterable<String> labelNames) liftToEntryPredicate
(BiPredicate<K, V> biPredicate) Adapts the supplied biFunction so that it can be used to process map entriesstatic com.google.common.base.Predicate<Method>
Get a predicate that returns true forMethod
s which have no argumentsstatic com.google.common.base.Predicate<Method>
methodNameMatchesPattern
(Pattern pattern) Get a predicate that returns true forMethod
s which name matched given patternstatic <T> Predicate<T>
onceTrueAlwaysTrue
(Predicate<T> predicate) Returns a predicate that once returns true, always return true.static <T> Predicate<T>
Converts list of predicates to one predicate which returns true if at least on predicate returns true (OR function)static @NotNull com.google.common.base.Predicate<Project>
projectIsNotEmpty
(@NotNull CachedPlanManager cachedPlanManager) Return predicate for filtering not empty projects (those which contain at least 1 plan)static @NotNull com.google.common.base.Predicate<SystemProperty>
static <T> Predicate<T>
testFirstApplyToAll
(Predicate<T> predicate) Returns a predicate that always returns the first value it returned.
-
Method Details
-
isNotDeleted
-
isAssignableFrom
-
projectIsNotEmpty
@NotNull public static @NotNull com.google.common.base.Predicate<Project> projectIsNotEmpty(@NotNull @NotNull CachedPlanManager cachedPlanManager) Return predicate for filtering not empty projects (those which contain at least 1 plan)- Parameters:
cachedPlanManager
- immutable plan cache service component- Returns:
- Predicate object
-
dependencyChildIsChain
@NotNull public static @NotNull com.google.common.base.Predicate<PlanDependency> dependencyChildIsChain() -
dependencyParentIsChain
@NotNull public static @NotNull com.google.common.base.Predicate<PlanDependency> dependencyParentIsChain() -
dependencyNotEditable
@NotNull public static @NotNull com.google.common.base.Predicate<PlanDependency> dependencyNotEditable() -
hasTestCases
-
labelNameIn
-
elasticInstanceScheduleIsEnabled
@NotNull public static @NotNull com.google.common.base.Predicate<ElasticInstanceSchedule> elasticInstanceScheduleIsEnabled() -
systemPropertyHasValue
@NotNull public static @NotNull com.google.common.base.Predicate<SystemProperty> systemPropertyHasValue() -
isFinalizingTaskDefinition
Get a predicate that returns true for TaskDefinition which are marked as "finalizing"- Returns:
- Predicate object
-
hasTaskDefinitionEqualId
-
isTaskResultPluginKeyEqual
public static com.google.common.base.Predicate<TaskResult> isTaskResultPluginKeyEqual(@NotNull @NotNull String pluginKey) Get a predicate that returns true forTaskResult
whichTaskDefinition
has equal pluginKey- Parameters:
pluginKey
- id to be matched inTaskDefinition
- Returns:
- Predicate object
-
capabilityKeyStartsWith
public static com.google.common.base.Predicate<Capability> capabilityKeyStartsWith(@NotNull @NotNull String prefix) Get a predicate that returns true forCapability
which key starts with given prefix- Parameters:
prefix
- prefix to be matched inCapability
- Returns:
- Predicate object
-
methodHasNoArguments
Get a predicate that returns true forMethod
s which have no arguments- Returns:
- Predicate object
-
methodNameMatchesPattern
Get a predicate that returns true forMethod
s which name matched given pattern- Parameters:
pattern
- pattern to be matched against method name- Returns:
- Predicate object
-
isChainTrigger
public static Predicate<PlanRepositoryDefinition> isChainTrigger(@NotNull @NotNull ImmutableChain chain, @Nullable @Nullable Set<Long> triggeringRepositories) -
hasBambooObjectEqualId
public static com.google.common.base.Predicate<BambooIdProvider> hasBambooObjectEqualId(@NotNull @NotNull BambooIdProvider bambooObject) -
hasBambooObjectEqualId
-
artifactLinkHasArtifactWithName
public static com.google.common.base.Predicate<ArtifactLink> artifactLinkHasArtifactWithName(@NotNull @NotNull String artifactName) - Parameters:
artifactName
- name of the artifact
-
artifactHasName
public static com.google.common.base.Predicate<Artifact> artifactHasName(@NotNull @NotNull String artifactName) - Parameters:
artifactName
- name of the artifact
-
hasEqualTitle
-
any
public static <T> com.google.common.base.Predicate<Iterable<? extends T>> any(@NotNull @NotNull com.google.common.base.Predicate<T> predicate) -
hasNotificationRuleRecipientType
public static Predicate<NotificationRule> hasNotificationRuleRecipientType(@NotNull @NotNull String recipientType) -
hasNotificationRuleRecipient
public static Predicate<NotificationRule> hasNotificationRuleRecipient(@NotNull @NotNull String recipient) -
distinct
Java Streams API is missing Stream#distinct(keyProvider), this is here to fill that gap -
liftToEntryPredicate
public static <K,V> Predicate<? super Map.Entry<K,V>> liftToEntryPredicate(BiPredicate<K, V> biPredicate) Adapts the supplied biFunction so that it can be used to process map entries -
compose
Predicate compose -
onceTrueAlwaysTrue
Returns a predicate that once returns true, always return true. -
testFirstApplyToAll
Returns a predicate that always returns the first value it returned. -
or
Converts list of predicates to one predicate which returns true if at least on predicate returns true (OR function)
-