Package com.atlassian.bamboo.utils
Class BambooPredicates
- java.lang.Object
-
- com.atlassian.bamboo.utils.BambooPredicates
-
public class BambooPredicates extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <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 forCapabilitywhich key starts with given prefixstatic <A,B>
Predicate<A>compose(Predicate<B> predicate, Function<A,? extends B> function)Predicate composestatic @NotNull com.google.common.base.Predicate<PlanDependency>dependencyChildIsChain()static @NotNull com.google.common.base.Predicate<PlanDependency>dependencyNotEditable()static @NotNull com.google.common.base.Predicate<PlanDependency>dependencyParentIsChain()static <T,K>
Predicate<T>distinct(Function<? super T,K> keyExtractor)Java Streams API is missing Stream#distinct(keyProvider), this is here to fill that gapstatic @NotNull com.google.common.base.Predicate<ElasticInstanceSchedule>elasticInstanceScheduleIsEnabled()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 booleanhasTestCases(@NotNull TestClassResult testClassResult)static com.google.common.base.Predicate<ImmutableArtifactDefinitionBase>isArtifactShared()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>isFinalizingTaskDefinition()Get a predicate that returns true for TaskDefinition which are marked as "finalizing"static booleanisNotDeleted(ImmutableDeletable deletable)static com.google.common.base.Predicate<TaskResult>isTaskResultPluginKeyEqual(@NotNull String pluginKey)Get a predicate that returns true forTaskResultwhichTaskDefinitionhas equal pluginKeystatic @NotNull com.google.common.base.Predicate<Labelling>labelNameIn(@NotNull Iterable<String> labelNames)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 entriesstatic com.google.common.base.Predicate<Method>methodHasNoArguments()Get a predicate that returns true forMethods which have no argumentsstatic com.google.common.base.Predicate<Method>methodNameMatchesPattern(Pattern pattern)Get a predicate that returns true forMethods 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>or(Iterable<Predicate<T>> predicates)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>systemPropertyHasValue()static <T> Predicate<T>testFirstApplyToAll(Predicate<T> predicate)Returns a predicate that always returns the first value it returned.
-
-
-
Method Detail
-
isNotDeleted
public static boolean isNotDeleted(ImmutableDeletable deletable)
-
isAssignableFrom
@NotNull public static <T> @NotNull com.google.common.base.Predicate<? super Class<? extends T>> isAssignableFrom(Class clazz)
-
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
public static boolean hasTestCases(@NotNull @NotNull TestClassResult testClassResult)
-
labelNameIn
@NotNull public static @NotNull com.google.common.base.Predicate<Labelling> labelNameIn(@NotNull @NotNull Iterable<String> labelNames)
-
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
public static com.google.common.base.Predicate<TaskDefinition> isFinalizingTaskDefinition()
Get a predicate that returns true for TaskDefinition which are marked as "finalizing"- Returns:
- Predicate object
-
hasTaskDefinitionEqualId
public static com.google.common.base.Predicate<TaskDefinition> hasTaskDefinitionEqualId(long id)
-
isTaskResultPluginKeyEqual
public static com.google.common.base.Predicate<TaskResult> isTaskResultPluginKeyEqual(@NotNull @NotNull String pluginKey)
Get a predicate that returns true forTaskResultwhichTaskDefinitionhas 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 forCapabilitywhich key starts with given prefix- Parameters:
prefix- prefix to be matched inCapability- Returns:
- Predicate object
-
methodHasNoArguments
public static com.google.common.base.Predicate<Method> methodHasNoArguments()
Get a predicate that returns true forMethods which have no arguments- Returns:
- Predicate object
-
methodNameMatchesPattern
public static com.google.common.base.Predicate<Method> methodNameMatchesPattern(Pattern pattern)
Get a predicate that returns true forMethods 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
public static com.google.common.base.Predicate<BambooIdProvider> hasBambooObjectEqualId(long id)
-
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
public static com.google.common.base.Predicate<TitleProvider> hasEqualTitle(String title)
-
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)
-
isArtifactShared
public static com.google.common.base.Predicate<ImmutableArtifactDefinitionBase> isArtifactShared()
-
distinct
public static <T,K> Predicate<T> distinct(Function<? super T,K> keyExtractor)
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
public static <A,B> Predicate<A> compose(Predicate<B> predicate, Function<A,? extends B> function)
Predicate compose
-
onceTrueAlwaysTrue
public static <T> Predicate<T> onceTrueAlwaysTrue(Predicate<T> predicate)
Returns a predicate that once returns true, always return true.
-
testFirstApplyToAll
public static <T> Predicate<T> testFirstApplyToAll(Predicate<T> predicate)
Returns a predicate that always returns the first value it returned.
-
-