Class JobInfoHelpers


  • public final class JobInfoHelpers
    extends Object
    Utility class which holds converters or predicates (matchers) to filter or convert job lists
    Since:
    1.12.0
    Author:
    lanwen (Merkushev Kirill)
    • Method Detail

      • withTrigger

        public static <ITEM extends Item> com.google.common.base.Predicate<ITEM> withTrigger​(Class<? extends Trigger> clazz)
        Parameters:
        clazz - trigger class to check in job
        Returns:
        predicate with true on apply if job contains trigger of given class
      • isBuildable

        public static <ITEM extends Item> com.google.common.base.Predicate<ITEM> isBuildable()
        Can be useful to ignore disabled jobs on reregistering hooks
        Returns:
        predicate with true on apply if item is buildable
      • associatedNames

        public static <ITEM extends Item> com.google.common.base.Function<ITEM,​Collection<GitHubRepositoryName>> associatedNames()
        Returns:
        function which helps to convert job to repo names associated with this job
      • isAlive

        public static <ITEM extends Item> com.google.common.base.Predicate<ITEM> isAlive()
        If any of event subscriber interested in hook for item, then return true By default, push hook subscriber is interested in job with gh-push-trigger
        Returns:
        predicate with true if item alive and should have hook
      • triggerFrom

        @Deprecated
        @CheckForNull
        public static <T extends Trigger> T triggerFrom​(Job<?,​?> job,
                                                        Class<T> tClass)
        Deprecated.
        Type Parameters:
        T - type of trigger
        Parameters:
        job - job to search trigger in
        tClass - trigger with class which we want to receive from job
        Returns:
        Trigger instance with required class or null TODO use standard method in 1.621+
      • triggerFrom

        @CheckForNull
        public static <T extends Trigger> T triggerFrom​(Item item,
                                                        Class<T> tClass)
        Type Parameters:
        T - type of trigger
        Parameters:
        item - job to search trigger in
        tClass - trigger with class which we want to receive from job
        Returns:
        Trigger instance with required class or null
        Since:
        1.25.0 TODO use standard method in 1.621+
      • asParameterizedJobMixIn

        public static <T extends JobParameterizedJobMixIn asParameterizedJobMixIn​(T job)
        Converts any child class of Job (such as AbstractProject to ParameterizedJobMixIn to use it for workflow
        Type Parameters:
        T - any child type of Job
        Parameters:
        job - to wrap
        Returns:
        ParameterizedJobMixIn TODO use standard method in 1.621+