Class BuildAction<T>

    • Constructor Detail

      • BuildAction

        protected BuildAction​(Run<?,​?> owner,
                              T result)
        Creates a new instance of BuildAction.
        Parameters:
        owner - the associated build that created the result
        result - the result to persist with this action
      • BuildAction

        public BuildAction​(Run<?,​?> owner,
                           T result,
                           boolean canSerialize)
        Creates a new instance of BuildAction.
        Parameters:
        owner - the associated build that created the result
        result - the result to persist with this action
        canSerialize - determines whether the result should be persisted in the build folder
    • Method Detail

      • createXmlStream

        protected abstract AbstractXmlStream<T> createXmlStream()
        Creates the XML stream to read the results. This method is invoked by the constructor in this BuildAction so this instance is not yet fully initialized when this factory method is called. So just return the stream instance without accessing any fields.
        Returns:
        the XML stream
      • getOwner

        public Run<?,​?> getOwner()
      • onLoad

        public void onLoad​(Run<?,​?> r)
        Specified by:
        onLoad in interface RunAction2
      • readResolve

        protected Object readResolve()
        Called after de-serialization to improve the memory usage.
        Returns:
        this
      • getResult

        public T getResult()
        Returns the repository statistics. Since the object requires some amount of memory, it is stored in a WeakReference. So if the current instance has been destroyed by the garbage collector then a new instance will be automatically created by reading the persisted XML data from Jenkins build folder.
        Returns:
        the statistics
      • getBuildResultBaseName

        protected abstract String getBuildResultBaseName()
      • getBuildActionFromHistoryStartingFrom

        public static <T extends BuildAction<?>> Optional<T> getBuildActionFromHistoryStartingFrom​(@CheckForNull
                                                                                                   Run<?,​?> baseline,
                                                                                                   Class<T> buildActionClass)
        Returns a BuildAction of the specified baseline build. If there is no such action for the baseline then the previous build is inspected, and so on. If no previous build contains a BuildAction then an empty result is returned.
        Type Parameters:
        T - type of the results
        Parameters:
        baseline - the baseline to start the search with
        buildActionClass - the type of the action to find
        Returns:
        the next available BuildAction, or an empty result if there is no such action