Class BambooPredicates


  • public class BambooPredicates
    extends Object
    • Method Detail

      • 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 for TaskResult which TaskDefinition has equal pluginKey
        Parameters:
        pluginKey - id to be matched in TaskDefinition
        Returns:
        Predicate object
      • capabilityKeyStartsWith

        public static com.google.common.base.Predicate<Capability> capabilityKeyStartsWith​(@NotNull
                                                                                           @NotNull String prefix)
        Get a predicate that returns true for Capability which key starts with given prefix
        Parameters:
        prefix - prefix to be matched in Capability
        Returns:
        Predicate object
      • methodHasNoArguments

        public static com.google.common.base.Predicate<Method> methodHasNoArguments()
        Get a predicate that returns true for Methods 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 for Methods which name matched given pattern
        Parameters:
        pattern - pattern to be matched against method name
        Returns:
        Predicate object
      • 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)
        A predicate that returns true if an ArtifactLink has an Artifact with name equal to the argument.
        Parameters:
        artifactName - name of the artifact
      • artifactHasName

        public static com.google.common.base.Predicate<Artifact> artifactHasName​(@NotNull
                                                                                 @NotNull String artifactName)
        A predicate that returns true if an Artifact has name equal to the argument.
        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)
      • 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.
      • or

        public 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)