Apache JMeter

## org.apache.jmeter.control
Class SwitchController

    java.lang.Object
      org.apache.jmeter.testelement.AbstractTestElement
          org.apache.jmeter.control.GenericController
              org.apache.jmeter.control.SwitchController

All Implemented Interfaces:
  Serializable, Cloneable, Controller, TestElement

    public class SwitchController

extends GenericController
implements Serializable

Implements a controller which selects at most one of its children based on the condition value, which may be a number or a string.

For numeric input, the controller processes the appropriate child, where the numbering starts from 0. If the number is out of range, then the first (0th) child is selected. If the condition is the empty string, then it is assumed to be 0.

For non-empty non-numeric input, the child is selected by name. This may be the name of the controller or a sampler. If the string does not match any of the names, then the controller with the name "default" (any case) is processed. If there is no default entry, then unlike the numeric case, no child is selected.

See Also:
  Serialized Form

Field Summary

Fields inherited from class org.apache.jmeter.control.GenericController
`current, subControllersAndSamplers`

Fields inherited from interface org.apache.jmeter.testelement.TestElement
`COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS`

Constructor Summary
`SwitchController()`

Method Summary
`String` `getSelection()`
`protected void` `incrementCurrent()` incrementCurrent is called when the current child (whether sampler or controller) has been processed.
`Sampler` `next()` Determines the next sampler to be processed.
`void` `setSelection(String inputValue)`

Methods inherited from class org.apache.jmeter.control.GenericController
`addIterationListener, addTestElement, currentReturnedNull, fireIterationStart, fireIterEvents, getCurrentElement, getIterCount, getSubControllers, incrementIterCount, initialize, isDone, isFirst, nextIsAController, nextIsASampler, nextIsNull, reInitialize, removeCurrentElement, resetCurrent, resetIterCount, setCurrentElement, setDone, setFirst`

Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement

`addProperty, canRemove, clear, clearTemporary, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.apache.jmeter.testelement.TestElement

`canRemove, clear, clone, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removeProperty, setComment, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse`

Constructor Detail

### SwitchController

    public SwitchController()

Method Detail

### next

    public Sampler next()

  Description copied from class: `GenericController`

  Determines the next sampler to be processed.

  If isDone, returns null.

  Gets the list element using current pointer. If this is null, calls `GenericController.nextIsNull()`.

  If the list element is a sampler, calls `GenericController.nextIsASampler(Sampler)`, otherwise calls `GenericController.nextIsAController(Controller)`

  If any of the called methods throws NextIsNullException, returns null, otherwise the value obtained above is returned.

  Specified by:
    `next` in interface `Controller`
  Overrides:
    `next` in class `GenericController`
  Returns:
    the next sampler or null

### incrementCurrent

    protected void incrementCurrent()

  incrementCurrent is called when the current child (whether sampler or controller) has been processed.

  Setting it to int.max marks the controller as having processed all its children. Thus the controller processes one child per iteration.

  Increments the current pointer; called by currentReturnedNull to move the controller on to its next child.

  Overrides:
    `incrementCurrent` in class `GenericController`

### setSelection

    public void setSelection(String inputValue)

### getSelection

    public String getSelection()

Apache JMeter

Copyright © 1998-2010 Apache Software Foundation. All Rights Reserved.