diff --git a/core/lib/Drupal/Component/Plugin/Context/Context.php b/core/lib/Drupal/Component/Plugin/Context/Context.php
index b117a72..13473bd 100644
--- a/core/lib/Drupal/Component/Plugin/Context/Context.php
+++ b/core/lib/Drupal/Component/Plugin/Context/Context.php
@@ -33,7 +33,7 @@ class Context implements ContextInterface {
   /**
    * Sets the contextDefinition for us without needing to call the setter.
    */
-  public function __construct(array $context_definition) {
+  public function __construct($context_definition) {
     $this->contextDefinition = $context_definition;
   }
 
@@ -54,7 +54,7 @@ public function getContextValue() {
   /**
    * Implements \Drupal\Component\Plugin\Context\ContextInterface::setContextDefinition().
    */
-  public function setContextDefinition(array $context_definition) {
+  public function setContextDefinition($context_definition) {
     $this->contextDefinition = $context_definition;
   }
 
diff --git a/core/lib/Drupal/Component/Plugin/Context/ContextInterface.php b/core/lib/Drupal/Component/Plugin/Context/ContextInterface.php
index c5cd743..a7dea2e 100644
--- a/core/lib/Drupal/Component/Plugin/Context/ContextInterface.php
+++ b/core/lib/Drupal/Component/Plugin/Context/ContextInterface.php
@@ -33,13 +33,11 @@ public function getContextValue();
   /**
    * Sets the definition that the context must conform to.
    *
-   * @param array $contextDefinition
+   * @param mixed $contextDefinition
    *   A defining characteristic representation of the context against which
-   *   that context can be validated. This is typically an array having a
-   *   class name set under the 'class' key, but it could be extended to support
-   *   other notations.
+   *   that context can be validated.
    */
-  public function setContextDefinition(array $contextDefinition);
+  public function setContextDefinition($contextDefinition);
 
   /**
    * Gets the provided definition that the context must conform to.
diff --git a/core/lib/Drupal/Core/Plugin/Context/Context.php b/core/lib/Drupal/Core/Plugin/Context/Context.php
index 2d79d6f..9554697 100644
--- a/core/lib/Drupal/Core/Plugin/Context/Context.php
+++ b/core/lib/Drupal/Core/Plugin/Context/Context.php
@@ -8,84 +8,107 @@
 namespace Drupal\Core\Plugin\Context;
 
 use Drupal\Component\Plugin\Context\Context as ComponentContext;
-use Drupal\Core\TypedData\ComplexDataInterface;
-use Drupal\Core\TypedData\DataDefinition;
-use Drupal\Core\TypedData\ListInterface;
+use Drupal\Core\Entity\ContentEntityInterface;
 use Drupal\Core\TypedData\TypedDataInterface;
 
 /**
  * A Drupal specific context wrapper class.
- *
- * The validate method is specifically overridden in order to support typed
- * data definitions instead of just class names in the contextual definitions
- * of plugins that extend ContextualPluginBase.
  */
 class Context extends ComponentContext {
 
   /**
-   * Overrides \Drupal\Component\Plugin\Context\Context::getContextValue().
+   * The data associated with the context.
+   *
+   * @var \Drupal\Core\TypedData\TypedDataInterface
+   */
+  protected $contextData;
+
+  /**
+   * The definition to which a context must conform.
+   *
+   * @var \Drupal\Core\Plugin\Context\ContextDefinitionInterface
+   */
+  protected $contextDefinition;
+
+  /**
+   * Constructs a Context object.
+   *
+   * @param \Drupal\Core\Plugin\Context\ContextDefinitionInterface $context_definition
+   *   The context definition.
+   */
+  public function __construct(ContextDefinitionInterface $context_definition) {
+    $this->contextDefinition = $context_definition;
+  }
+
+  /**
+   * {@inheritdoc}
    */
   public function getContextValue() {
-    $typed_value = parent::getContextValue();
-    // If the typed data is complex, pass it on as typed data. Else pass on its
-    // plain value, such that e.g. a string will be directly returned as PHP
-    // string.
-    $is_complex = $typed_value instanceof ComplexDataInterface;
-    if (!$is_complex && $typed_value instanceof ListInterface) {
-      $is_complex = $typed_value[0] instanceof ComplexDataInterface;
+    if (!isset($this->contextData)) {
+      return NULL;
     }
-    if ($typed_value instanceof TypedDataInterface && !$is_complex) {
-      return $typed_value->getValue();
+    // Special case entities.
+    // @todo: Remove once entities do not implemented TypedDataInterface any
+    //   more.
+    if ($this->contextData instanceof ContentEntityInterface) {
+      return $this->contextData;
     }
-    return $typed_value;
+    return $this->contextData->getValue();
   }
 
   /**
    * Implements \Drupal\Component\Plugin\Context\ContextInterface::setContextValue().
    */
   public function setContextValue($value) {
-    // Make sure the value set is a typed data object.
-    if (!empty($this->contextDefinition['type']) && !$value instanceof TypedDataInterface) {
-      $value = \Drupal::typedDataManager()->create(new DataDefinition($this->contextDefinition), $value);
+    if ($value instanceof TypedDataInterface) {
+      return $this->setContextData($value);
+    }
+    else {
+      return $this->setContextData(\Drupal::typedDataManager()->create($this->contextDefinition->getDataDefinition(), $value));
     }
-    parent::setContextValue($value);
   }
 
   /**
-   * Gets the context value as typed data object.
-   *
-   * parent::getContextValue() does not do all the processing required to
-   * return plain value of a TypedData object. This class overrides that method
-   * to return the appropriate values from TypedData objects, but the object
-   * itself can be useful as well, so this method is provided to allow for
-   * access to the TypedData object. Since parent::getContextValue() already
-   * does all the processing we need, we simply proxy to it here.
-   *
-   * @return \Drupal\Core\TypedData\TypedDataInterface
+   * Implements \Drupal\Component\Plugin\Context\ContextInterface::getConstraints().
    */
-  public function getTypedContext() {
-    return parent::getContextValue();
+  public function getConstraints() {
+    return $this->contextDefinition->getConstraints();
   }
 
   /**
-   * Implements \Drupal\Component\Plugin\Context\ContextInterface::getConstraints().
+   * {@inheritdoc}
    */
-  public function getConstraints() {
-    if (!empty($this->contextDefinition['type'])) {
-      // If we do have typed data, leverage it for getting constraints.
-      return $this->getTypedContext()->getConstraints();
-    }
-    return parent::getConstraints();
+  public function getContextData() {
+    return $this->contextData;
   }
 
   /**
-   * Overrides \Drupal\Component\Plugin\Context\Context::getConstraints().
+   * {@inheritdoc}
+   */
+  public function setContextData(TypedDataInterface $data) {
+    $this->contextData = $data;
+    return $this;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getContextDefinition() {
+    return $this->contextDefinition;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setContextDefinition($context_definition) {
+    $this->contextDefinition = $context_definition;
+  }
+
+  /**
+   * {@inheritdoc}
    */
   public function validate() {
-    // If the context is typed data, defer to its validation.
-    if (!empty($this->contextDefinition['type'])) {
-      return $this->getTypedContext()->validate();
-    }
-    return parent::validate();
+    return $this->getContextData()->validate();
   }
+
 }
diff --git a/core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php b/core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php
new file mode 100644
index 0000000..fc851d3
--- /dev/null
+++ b/core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php
@@ -0,0 +1,227 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Plugin\Context\ContextDefinition.
+ */
+
+namespace Drupal\Core\Plugin\Context;
+
+use Drupal\Core\TypedData\TypedDataManager;
+
+/**
+ * Defines a class for context definitions.
+ */
+class ContextDefinition implements ContextDefinitionInterface {
+
+  /**
+   * The data type of the data.
+   *
+   * @return string
+   *   The data type.
+   */
+  protected $dataType;
+
+  /**
+   * The human-readable label.
+   *
+   * @return string
+   *   The label.
+   */
+  protected $label;
+
+  /**
+   * The human-readable description.
+   *
+   * @return string|null
+   *   The description, or NULL if no description is available.
+   */
+  protected $description;
+
+  /**
+   * Whether the data is multi-valued, i.e. a list of data items.
+   *
+   * @var bool
+   */
+  protected $isMultiple = FALSE;
+
+  /**
+   * Determines whether a data value is required.
+   *
+   * @var bool
+   *   Whether a data value is required.
+   */
+  protected $isRequired = TRUE;
+
+  /**
+   * An array of constraints.
+   *
+   * @var array[]
+   */
+  protected $constraints = [];
+
+  /**
+   * The typed data manager used for creating the data types of the context.
+   *
+   * @var \Drupal\Core\TypedData\TypedDataManager
+   */
+  protected $typedDataManager;
+
+  /**
+   * Creates a new context definition.
+   *
+   * @param \Drupal\Core\TypedData\TypedDataManager $typed_data_manager
+   *   The typed data manager.
+   * @param string $data_type
+   *   The data type for which to create the context definition. Defaults to
+   *   'any'.
+   *
+   * @return static
+   *   The created context definition object.
+   */
+  public static function create(TypedDataManager $typed_data_manager, $data_type = 'any') {
+    return new static(
+      $typed_data_manager,
+      $data_type
+    );
+  }
+
+  /**
+   * Constructs a new context definition object.
+   *
+   * @param \Drupal\Core\TypedData\TypedDataManager $typed_data_manager
+   *   The typed data manager.
+   * @param string $data_type
+   *   The required data type.
+   */
+  public function __construct(TypedDataManager $typed_data_manager, $data_type = 'any') {
+    $this->typedDataManager = $typed_data_manager;
+    $this->dataType = $data_type;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getDataType() {
+    return $this->dataType;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setDataType($data_type) {
+    $this->dataType = $data_type;
+    return $this;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getLabel() {
+    return $this->label;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setLabel($label) {
+    $this->label = $label;
+    return $this;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getDescription() {
+    return $this->description;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setDescription($description) {
+    $this->description = $description;
+    return $this;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function isMultiple() {
+    return $this->isMultiple;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setMultiple($multiple = TRUE) {
+    $this->isMultiple = $multiple;
+    return $this;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function isRequired() {
+    return $this->isRequired;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setRequired($required = TRUE) {
+    $this->isRequired = $required;
+    return $this;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getConstraints() {
+    // @todo Apply defaults.
+    return $this->constraints;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getConstraint($constraint_name) {
+    $constraints = $this->getConstraints();
+    return isset($constraints[$constraint_name]) ? $constraints[$constraint_name] : NULL;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setConstraints(array $constraints) {
+    $this->constraints = $constraints;
+    return $this;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function addConstraint($constraint_name, $options = NULL) {
+    $this->constraints[$constraint_name] = $options;
+    return $this;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getDataDefinition() {
+    // @todo Setters are missing from the core data definition interfaces.
+    if ($this->isMultiple()) {
+      $definition = $this->typedDataManager->createListDataDefinition($this->getDataType());
+    }
+    else {
+      $definition = $this->typedDataManager->createDataDefinition($this->getDataType());
+    }
+    $definition->setLabel($this->getLabel())
+      ->setDescription($this->getDescription())
+      ->setRequired($this->isRequired())
+      ->setConstraints($this->getConstraints());
+    return $definition;
+  }
+
+}
diff --git a/core/lib/Drupal/Core/Plugin/Context/ContextDefinitionInterface.php b/core/lib/Drupal/Core/Plugin/Context/ContextDefinitionInterface.php
new file mode 100644
index 0000000..8871def
--- /dev/null
+++ b/core/lib/Drupal/Core/Plugin/Context/ContextDefinitionInterface.php
@@ -0,0 +1,175 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Plugin\Context\ContextDefinitionInterface.
+ */
+
+namespace Drupal\Core\Plugin\Context;
+
+/**
+ * Interface for context definitions.
+ */
+interface ContextDefinitionInterface {
+
+  /**
+   * Returns a human readable label.
+   *
+   * @return string
+   *   The label.
+   */
+  public function getLabel();
+
+  /**
+   * Sets the human readable label.
+   *
+   * @param string $label
+   *   The label to set.
+   *
+   * @return $this
+   */
+  public function setLabel($label);
+
+  /**
+   * Returns a human readable description.
+   *
+   * @return string|null
+   *   The description, or NULL if no description is available.
+   */
+  public function getDescription();
+
+  /**
+   * Sets the human readable description.
+   *
+   * @param string|null $description
+   *   The description to set.
+   *
+   * @return $this
+   */
+  public function setDescription($description);
+
+  /**
+   * Returns the data type needed by the context.
+   *
+   * If the context is multiple-valued, this represents the type of each value.
+   *
+   * @return string
+   *   The data type.
+   */
+  public function getDataType();
+
+  /**
+   * Sets the data type needed by the context.
+   *
+   * @param string $data_type
+   *   The data type to set.
+   *
+   * @return $this
+   */
+  public function setDataType($data_type);
+
+  /**
+   * Returns whether the data is multi-valued, i.e. a list of data items.
+   *
+   * This is equivalent to checking whether the data definition implements the
+   * \Drupal\Core\TypedData\ListDefinitionInterface interface.
+   *
+   * @return bool
+   *   Whether the data is multi-valued; i.e. a list of data items.
+   */
+  public function isMultiple();
+
+  /**
+   * Sets whether the data is multi-valued.
+   *
+   * @param bool $multiple
+   *   (optional) Whether the data is multi-valued. Defaults to TRUE.
+   *
+   * @return $this
+   */
+  public function setMultiple($multiple = TRUE);
+
+  /**
+   * Determines whether the context is required.
+   *
+   * For required data a non-NULL value is mandatory.
+   *
+   * @return bool
+   *   Whether a data value is required.
+   */
+  public function isRequired();
+
+  /**
+   * Sets whether the data is required.
+   *
+   * @param bool $required
+   *   (optional) Whether the data is multi-valued. Defaults to TRUE.
+   *
+   * @return $this
+   */
+  public function setRequired($required = TRUE);
+
+  /**
+   * Returns an array of validation constraints.
+   *
+   * See \Drupal\Core\TypedData\TypedDataManager::getConstraints() for details.
+   *
+   * @return array
+   *   An array of validation constraint definitions, keyed by constraint name.
+   *   Each constraint definition can be used for instantiating
+   *   \Symfony\Component\Validator\Constraint objects.
+   */
+  public function getConstraints();
+
+  /**
+   * Sets the array of validation constraints.
+   *
+   * NOTE: This will override any previously set constraints. In most cases
+   * ContextDefinitionInterface::addConstraint() should be used instead.
+   *
+   * @param array $constraints
+   *   The array of constraints. See
+   *   \Drupal\Core\TypedData\TypedDataManager::getConstraints() for details.
+   *
+   * @return $this
+   *
+   * @see self::addConstraint()
+   */
+  public function setConstraints(array $constraints);
+
+  /**
+   * Adds a validation constraint.
+   *
+   * See \Drupal\Core\TypedData\TypedDataManager::getConstraints() for details.
+   *
+   * @param string $constraint_name
+   *   The name of the constraint to add, i.e. its plugin id.
+   * @param array|null $options
+   *   The constraint options as required by the constraint plugin, or NULL.
+   *
+   * @return $this
+   */
+  public function addConstraint($constraint_name, $options = NULL);
+
+  /**
+   * Returns a validation constraint.
+   *
+   * See \Drupal\Core\TypedData\TypedDataManager::getConstraints() for details.
+   *
+   * @param string $constraint_name
+   *   The name of the the constraint, i.e. its plugin id.
+   *
+   * @return array
+   *   A validation constraint definition which can be used for instantiating a
+   *   \Symfony\Component\Validator\Constraint object.
+   */
+  public function getConstraint($constraint_name);
+
+  /**
+   * Returns the data definition of the defined context.
+   *
+   * @return \Drupal\Core\TypedData\DataDefinitionInterface
+   */
+  public function getDataDefinition();
+
+}
diff --git a/core/lib/Drupal/Core/Plugin/Context/ContextInterface.php b/core/lib/Drupal/Core/Plugin/Context/ContextInterface.php
new file mode 100644
index 0000000..fac8d7e
--- /dev/null
+++ b/core/lib/Drupal/Core/Plugin/Context/ContextInterface.php
@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Plugin\Context\ContextInterface.
+ */
+
+namespace Drupal\Core\Plugin\Context;
+
+use \Drupal\Component\Plugin\Context\ContextInterface as ComponentContextInterface;
+use Drupal\Core\TypedData\TypedDataInterface;
+
+/**
+ * Interface for context.
+ */
+interface ContextInterface extends ComponentContextInterface {
+
+  /**
+   * Gets the context value as typed data object.
+   *
+   * @return \Drupal\Core\TypedData\TypedDataInterface
+   */
+  public function getContextData();
+
+  /**
+   * Sets the context value as typed data object.
+   *
+   * @param \Drupal\Core\TypedData\TypedDataInterface $data
+   *   The context value as a typed data object.
+   *
+   * @return $this
+   */
+  public function setContextData(TypedDataInterface $data);
+
+}
diff --git a/core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php b/core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php
index 43d3a66..e688661 100644
--- a/core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php
+++ b/core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php
@@ -7,21 +7,16 @@
 
 namespace Drupal\Core\Plugin;
 
-use Drupal\Component\Plugin\ContextAwarePluginBase as ComponentContextAwarePluginBase;
+use Drupal\Component\Plugin\Exception\ContextException;
 use Drupal\Core\Plugin\Context\Context;
-use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
-use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Symfony\Component\DependencyInjection\ContainerInterface;
+use Drupal\Core\Plugin\Context\ContextInterface;
+use Symfony\Component\Validator\ConstraintViolationList;
 
 /**
- * Drupal specific class for plugins that use context.
- *
- * This class specifically overrides setContextValue to use the core version of
- * the Context class. This code is exactly the same as what is in Component
- * ContextAwarePluginBase but it is using a different Context class.
+ * Base class for plugins that are context aware.
  */
-abstract class ContextAwarePluginBase extends ComponentContextAwarePluginBase {
-  use StringTranslationTrait;
+abstract class ContextAwarePluginBase extends PluginBase implements ContextAwarePluginInterface {
 
   /**
    * An array of service IDs keyed by property name used for serialization.
@@ -34,35 +29,123 @@
   protected $_serviceIds = array();
 
   /**
-   * Override of \Drupal\Component\Plugin\ContextAwarePluginBase::__construct().
+   * The contexts of this plugin.
+   *
+   * @var \Drupal\Core\Plugin\Context\ContextInterface[]
+   */
+  protected $contexts;
+
+  /**
+   * The context definitions of this plugin.
+   *
+   * @var \Drupal\Core\Plugin\Context\ContextDefinitionInterface[]
+   */
+  protected $contextDefinitions;
+
+  /**
+   * Defines the needed context of this plugin.
+   *
+   * @todo: Can we make this abstract somehow?
+   *
+   * @return \Drupal\Core\Plugin\Context\ContextDefinitionInterface[]
+   *   The array of context definitions, keyed by context name.
+   */
+  public static function contextDefinitions() {
+    return [];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getContextDefinitions() {
+    if (!isset($this->contextDefinitions)) {
+      $this->contextDefinitions = static::contextDefinitions();
+    }
+    return $this->contextDefinitions;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getContextDefinition($name) {
+    $definitions = $this->getContextDefinitions();
+    if (empty($definitions[$name])) {
+      throw new ContextException("The $name context is not a valid context.");
+    }
+    return $definitions[$name];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getContexts() {
+    // Make sure all context objects are initialized.
+    foreach ($this->getContextDefinitions() as $name => $definition) {
+      $this->getContext($name);
+    }
+    return $this->contexts;
+  }
+
+  /**
+   * {@inheritdoc}
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition) {
-    $context = array();
-    if (isset($configuration['context'])) {
-      $context = $configuration['context'];
-      unset($configuration['context']);
+  public function getContext($name) {
+    // Check for a valid context value.
+    if (!isset($this->contexts[$name])) {
+      $this->contexts[$name] = new Context($this->getContextDefinition($name));
     }
-    parent::__construct($configuration, $plugin_id, $plugin_definition);
-    foreach ($context as $key => $value) {
-      $context_definition = $this->getContextDefinition($key);
-      $this->context[$key] = new Context($context_definition);
-      $this->context[$key]->setContextValue($value);
+    return $this->contexts[$name];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setContext($name, ContextInterface $context) {
+    $this->contexts[$name] = $context;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getContextValues() {
+    $values = [];
+    foreach ($this->getContextDefinitions() as $name => $definition) {
+      $values[$name] = isset($this->contexts[$name]) ? $this->contexts[$name]->getContextValue() : NULL;
     }
+    return $values;
   }
 
   /**
-   * Override of \Drupal\Component\Plugin\ContextAwarePluginBase::setContextValue().
+   * {@inheritdoc}
+   */
+  public function getContextValue($name) {
+    return $this->getContext($name)->getContextValue();
+  }
+
+  /**
+   * {@inheritdoc}
    */
   public function setContextValue($name, $value) {
-    $context_definition = $this->getContextDefinition($name);
-    // Use the Drupal specific context class.
-    $this->context[$name] = new Context($context_definition);
-    $this->context[$name]->setContextValue($value);
+    $this->getContext($name)->setContextValue($value);
     return $this;
   }
 
   /**
    * {@inheritdoc}
+   */
+  public function validateContexts() {
+    $violations = new ConstraintViolationList();
+    // @todo: Implement symfony validator API to let the validator traverse
+    // and set property paths accordingly.
+
+    foreach ($this->getContexts() as $context) {
+      $violations->addAll($context->validate());
+    }
+    return $violations;
+  }
+
+  /**
+   * {@inheritdoc}
    *
    * @todo Remove when Drupal\Core\DependencyInjection\DependencySerialization
    *   is converted to a trait in https://drupal.org/node/2208115.
diff --git a/core/lib/Drupal/Core/Plugin/ContextAwarePluginInterface.php b/core/lib/Drupal/Core/Plugin/ContextAwarePluginInterface.php
new file mode 100644
index 0000000..e6112b2
--- /dev/null
+++ b/core/lib/Drupal/Core/Plugin/ContextAwarePluginInterface.php
@@ -0,0 +1,28 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Plugin\ContextAwarePluginInterface.
+ */
+
+namespace Drupal\Core\Plugin;
+
+use Drupal\Component\Plugin\ContextAwarePluginInterface as ComponentContextAwarePluginInterface;
+use Drupal\Core\Plugin\Context\ContextInterface;
+
+/**
+ * Interface for context-aware plugins.
+ */
+interface ContextAwarePluginInterface extends ComponentContextAwarePluginInterface {
+
+  /**
+   * Set a context on this plugin.
+   *
+   * @param string $name
+   *   The name of the context in the plugin configuration.
+   * @param \Drupal\Core\Plugin\Context\ContextInterface $context
+   *   The context object to set.
+   */
+  public function setContext($name, ContextInterface $context);
+
+}
