> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dairy.foundation/llms.txt
> Use this file to discover all available pages before exploring further.

# The FeatureRegistrar

The `FeatureRegistrar` is a singleton that manages `Feature`s, but also makes it
possible to access a lot of information about the currently running OpMode
statically.

<CodeGroup>
  ```java Java theme={null}
  // is an OpMode running?
  // this will return true most of the time
  // as when a user OpMode isn't running, the SDK runs a special OpMode behind the scenes
  FeatureRegistrar.isOpModeRunning();
  // the active OpMode,
  // this method exhibits undefined behaviour if isOpModeRunning returns false
  FeatureRegistrar.getActiveOpMode();
  // the active Wrapper, Wrapper is a Dairy class for wrapping over an OpMode and some additional information
  // this method exhibits undefined behaviour if isOpModeRunning returns false
  Wrapper wrapper = FeatureRegistrar.getActiveOpModeWrapper();
  // get the Wrapper.State of the currently running Wrapper
  // this method exhibits undefined behaviour if isOpModeRunning returns false
  Wrapper.OpModeState state = FeatureRegistrar.getOpModeState();
  // state:
  // INIT
  // ACTIVE
  // STOPPED
  ```

  ```kt Kotlin theme={null}
  // is an OpMode running?
  // this will return true most of the time
  // as when a user OpMode isn't running, the SDK runs a special OpMode behind the scenes
  FeatureRegistrar.opModeRunning
  // the active OpMode,
  // this method exhibits undefined behaviour if isOpModeRunning returns false
  FeatureRegistrar.activeOpMode
  // the active Wrapper, Wrapper is a Dairy class for wrapping over an OpMode and some additional information
  // this method exhibits undefined behaviour if isOpModeRunning returns false
  val wrapper: Wrapper = FeatureRegistrar.activeOpModeWrapper
  // get the Wrapper.State of the currently running Wrapper
  // this method exhibits undefined behaviour if isOpModeRunning returns false
  val state: Wrapper.OpModeState = FeatureRegistrar.opModeState
  // state:
  // INIT
  // ACTIVE
  // STOPPED
  ```
</CodeGroup>

Lets take a closer look at what `Wrapper` can provide us.

<CodeGroup>
  ```java Java theme={null}
  // the same state we just saw
  wrapper.getState();
  // the name of the OpMode
  wrapper.getName();
  // the sdk's classification of type (known as Flavour)
  // SYSTEM
  // TELEOP
  // AUTONOMOUS
  wrapper.getOpModeType();
  // if we want to inspect all the annotations
  wrapper.getInheritedAnnotations();
  // the OpModeMeta of the OpMode, this is how the sdk stores metadata about the OpMode
  wrapper.getMeta();
  // the actual OpMode
  wrapper.getOpMode();
  // active Features, we'll review these later
  wrapper.getActiveFeatures();
  ```

  ```kt Kotlin theme={null}
  // the same state we just saw
  wrapper.state
  // the name of the OpMode
  wrapper.name
  // the sdk's classification of type (known as Flavour)
  // SYSTEM
  // TELEOP
  // AUTONOMOUS
  wrapper.opModeType
  // if we want to inspect all the annotations
  wrapper.inheritedAnnotations
  // the OpModeMeta of the OpMode, this is how the sdk stores metadata about the OpMode
  wrapper.meta
  // the actual OpMode
  wrapper.opMode
  // active Features, we'll review these later
  wrapper.activeFeatures
  ```
</CodeGroup>
