Package hudson.matrix

Class Axis

    • Field Detail

      • name

        public final String name
        as of 1.373 Use getName()
        Name of this axis. Used as a variable name.
      • values

        public final List<String> values
        as of 1.373 Use getValues()
        Possible values for this axis.
    • Constructor Detail

      • Axis

        public Axis​(String name,
                    String valueString)
        Used to build Axis from form. Axis with empty values need to be removed later.
    • Method Detail

      • isSystem

        public boolean isSystem()
        as of 1.373 System vs user difference are generalized into extension point.
        Returns true if this axis is a system-reserved axis that used to have special treatment.
      • size

        public int size()
      • value

        public String value​(int index)
      • compareTo

        public int compareTo​(Axis that)
        Axis is fully ordered so that we can convert between a list of axis and a string unambiguously.
        Specified by:
        compareTo in interface Comparable<Axis>
      • hashCode

        public int hashCode()
        hashCode in class Object
      • getName

        public String getName()
        Name of this axis. Used as a variable name.
      • getValues

        public List<String> getValues()
        Possible values for this axis.
      • rebuild

        public List<String> rebuild​(MatrixBuild.MatrixBuildExecution context)
        Called right at the beginning of MatrixBuild execution to allow Axis to update values based on the current build.

        Historically, axes values are considered static. They were assumed to reflect what the user has typed in, and their values are changed only when the project is reconfigured. So abstractions are built around this notion, and so for example MatrixProject has the current axes and their values, which it uses to render its UI.

        So when the need was identified to change the values of axes per build, we decided that this be represented as a kind of project configuration update (where a project gets reconfigured every time a build runs), and this call back was added to allow Axis to update the next return value from the getValues() (which is typically done by updating values.)

        While it is not strictly required, because of these historical reasons, UI will look better if Future calls to getValues() return the same values as what this method returns (until the next rebuild call).

        context - The ongoing build. Never null.
        Never null. Returns the updated set of values.
      • getValueString

        public String getValueString()
        Used for generating the config UI. If the axis is big and occupies a lot of space, use newline for separator to display multi-line text.
      • parsePrefixed

        public static Axis parsePrefixed​(org.kohsuke.stapler.StaplerRequest req,
                                         String name)
        Parses the submitted form (where possible values are presented as a list of checkboxes) and creates an axis
      • readResolve

        public Object readResolve()
        Previously we used to persist Axis, but now those are divided into subtypes. So upon deserialization, resolve to the proper type.
      • addBuildVariable

        public void addBuildVariable​(String value,
                                     Map<String,​String> map)
        Converts the selected value (which is among values) and adds that to the given map, which serves as the build variables.