public function setCaption($value) {
    $class = CaptionDescriptor::class;
    if (is_object($value)) {
      if ($value instanceof $class) {
        $this->caption = $value;
      }
      else {
        $this->triggerError("Caption not of class ${class}.");
      }
    }
    else {
      $this->caption = (string) $value;
    }
    return $this;
  }