protected function validateValueAgainstValidateType($name, $value) {
    // don't validate referenced values
    $mapper = $this->getMapper();
    if ($mapper->hasAttribute($name) && $mapper->getAttribute($name) instanceof ReferenceDescription) {
      return;
    }
    $validateType = $this->getValueProperty($name, 'validate_type');
    if (($validateType == '' || Validator::validate($value, $validateType,
            ['entity' => $this, 'value' => $name]))) {
      return;
    }
    // construct the error message
    $messageInstance = ObjectFactory::getInstance('message');
    $validateDescription = $this->getValueProperty($name, 'validate_description');
    if (strlen($validateDescription) > 0) {
      // use configured message if existing
      $errorMessage = $messageInstance->getText($validateDescription);
    }
    else {
      // default text
      $errorMessage = $messageInstance->getText("The value of '%0%' (%1%) is invalid.", [$messageInstance->getText($name), $value]);
    }
    throw new ValidationException($name, $value, $errorMessage);
  }