Sets the class name. Note, this will overwrite the current class name, also valid in case of MVC callback.

@param string $className Fully qualified class name.

@throws \Exception | BootstrapException
546253
public function setClassName($className)
    {
        try {
            $classFilename = ClassLoader::getInstance()->findClass($className);
            if (!file_exists($classFilename)) {
                throw new BootstrapException('The provided callback class "' . $className . '" does not exist.');
            } else {
                $this->className = $className;
            }
        } catch (\Exception $e) {
            throw $e;
        }
    }
1331453
public function setDefaultRepositoryClassName($className)
    {
        $reflectionClass = new \ReflectionClass($className);

        if (!$reflectionClass->implementsInterface(ObjectRepository::class)) {
            throw ODMException::invalidDocumentRepository($className);
        }

        $this->odmOptions['defaultRepositoryClassName'] = $className;
    }
362349
protected function forgetClass($className)
    {
        $this->log('Forget class ' . $className, LogLevel::DEBUG);
        if (isset($this->classesCurrentlyBeingForgotten[$className])) {
            $this->log('Detected recursion while forgetting class ' . $className, LogLevel::WARNING);
            return;
        }
        $this->classesCurrentlyBeingForgotten[$className] = true;

        if (class_exists($className)) {
            $interfaceNames = class_implements($className);
            foreach ($interfaceNames as $interfaceName) {
                if (isset($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS][$className])) {
                    unset($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS][$className]);
                }
            }
        } else {
            foreach ($this->availableClassNames as $interfaceNames) {
                foreach ($interfaceNames as $interfaceName) {
                    if (isset($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS][$className])) {
                        unset($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS][$className]);
                    }
                }
            }
        }

        if (isset($this->classReflectionData[$className][self::DATA_CLASS_SUBCLASSES])) {
            foreach (array_keys($this->classReflectionData[$className][self::DATA_CLASS_SUBCLASSES]) as $subClassName) {
                $this->forgetClass($subClassName);
            }
        }

        foreach (array_keys($this->annotatedClasses) as $annotationClassName) {
            if (isset($this->annotatedClasses[$annotationClassName][$className])) {
                unset($this->annotatedClasses[$annotationClassName][$className]);
            }
        }

        if (isset($this->classSchemata[$className])) {
            unset($this->classSchemata[$className]);
        }

        foreach (array_keys($this->classesByMethodAnnotations) as $annotationClassName) {
            unset($this->classesByMethodAnnotations[$annotationClassName][$className]);
        }

        unset($this->classReflectionData[$className]);
        unset($this->classesCurrentlyBeingForgotten[$className]);
    }
740696
protected function setClass($class): void
    {
        // @todo fix logic about storing the classname
        $this->className = $class;
        if (is_object($class)) {
            $this->className = get_class($class);
        }
        $this->class = new ReflectionClass($class);
    }
17017
final protected function assertClassExists(string $className): void
    {
        self::assertTrue(\class_exists($className), \sprintf(
            'Failed asserting that a class "%s" exists.',
            $className
        ));
    }
747944
public function addClass($className) {
        $oldClassName    = $this->getAttributeValue('class');
        $oldClassNameArr = $oldClassName ? explode(' ', $oldClassName) : array();
        $classNameArr    = array_merge($oldClassNameArr, explode(' ', $className));
        // housekeeping
        $classNameArr    = array_unique(array_filter(array_map('trim', $classNameArr)));
        $this->setAttribute('class', implode(' ', $classNameArr));
    }
1328835
public function setUsername($username = '')
    {
        $this->username = $username;
        $this->_debug->info(__FUNCTION__, 'setUsername: ', $this->username);
    }
58019
private function throwIfNotEntity(string $className): void
    {
        if (!$this->isEntity($className)) {
            throw new \UnexpectedValueException('Given class name `' . $className . '` is not a Doctrine entity. Either register a custom GraphQL type for `' . $className . '` when instantiating `' . self::class . '`, or change the usage of that class to something else.');
        }
    }
622819
public static function setDateTimeClassName(string $className)
    {
        if(!class_exists($className)) {
            throw new \InvalidArgumentException($className . ' does not exist');
        }

        self::$_dateTimeClassName = $className;
    }
1051320
public void setClassname(final String className) {
    Object proc = null;
    try {
      final Class<?> implClass = ProjectDef.class.getClassLoader().loadClass(className);
      try {
        final Method getInstance = implClass.getMethod("getInstance");
        proc = getInstance.invoke(null);
      } catch (final Exception ex) {
        proc = implClass.newInstance();
      }
    } catch (final Exception ex) {
      throw new BuildException(ex);
    }
    this.projectWriter = (ProjectWriter) proc;
  }
931103
protected function setResourceClassName($resourceClassName)
    {
        if (!is_string($resourceClassName)) {
            throw new \InvalidArgumentException('The resource class name could be a string.');
        }

        if (empty($resourceClassName)) {
            throw new \InvalidArgumentException('The resource class name could not be empty.');
        }

        $this->resourceClassName = $resourceClassName;
    }
59044
public function setDefaultRepositoryClassName($className)
    {
        $reflectionClass = new \ReflectionClass($className);

        if ( ! $reflectionClass->implementsInterface('Doctrine\Common\Persistence\ObjectRepository')) {
            throw ORMException::invalidEntityRepository($className);
        }

        $this->_attributes['defaultRepositoryClassName'] = $className;
    }
987521
protected static function eventClassCheck(string $className) : void
    {
        if (!class_exists($className) || !is_subclass_of($className, EventInterface::class)) {
            throw new ClassNotImplementsEventInterfaceException($className);
        }
    }
201180
public function named(string $className): self
    {
        if ($this->isFinalized) {
            throw new FinalizedMockException();
        }

        if ('' !== $className) {
            if (
                !preg_match('/^' . static::SYMBOL_PATTERN . '$/S', $className)
            ) {
                throw new InvalidClassNameException($className);
            }
        }

        $this->className = $className;

        return $this;
    }
1274039
public void setClassName(String className) {

        checkFrozen();
        if (className != null) {
            // remove leading or trailing white space
            className = className.trim();
        }
        if (!CmsStringUtil.isValidJavaClassName(className)) {
            CmsMessageContainer message = Messages.get().container(Messages.ERR_BAD_JOB_CLASS_NAME_1, className);
            if (OpenCms.getRunLevel() > OpenCms.RUNLEVEL_2_INITIALIZING) {
                throw new CmsIllegalArgumentException(message);
            } else {
                LOG.warn(message.key());
            }
        } else {
            Class<?> jobClass;
            try {
                jobClass = Class.forName(className);
                if (!I_CmsScheduledJob.class.isAssignableFrom(jobClass)) {
                    CmsMessageContainer message = Messages.get().container(
                        Messages.ERR_JOB_CLASS_BAD_INTERFACE_2,
                        className,
                        I_CmsScheduledJob.class.getName());

                    if (OpenCms.getRunLevel() > OpenCms.RUNLEVEL_2_INITIALIZING) {
                        throw new CmsIllegalArgumentException(message);
                    } else {
                        LOG.warn(message.key());
                    }

                }
            } catch (ClassNotFoundException e) {
                CmsMessageContainer message = Messages.get().container(Messages.ERR_JOB_CLASS_NOT_FOUND_1, className);
                if (OpenCms.getRunLevel() > OpenCms.RUNLEVEL_2_INITIALIZING) {
                    throw new CmsIllegalArgumentException(message);
                } else {
                    LOG.warn(message.key());
                }

            }
        }
        m_className = className;
        if (getJobName() == null) {
            // initialize job name with class name as default
            setJobName(className);
        }

    }
107660
public function removeClass($className)
    {
        $existingClasses = !empty($this->attributes['class'])
            ? explode(' ',$this->attributes['class'])
            : array();
        unset($existingClasses[array_search($className, $existingClasses)]);
        $this->attributes['class'] = implode(' ', $existingClasses);
    }
530108
public function create(string $className)
    {
        if (!class_exists($className)) {
            $classFileName = $this->fileNameforClass($className);
            $this->createFile($classFileName, $className, 'class.tmpl');
            $this->console->writeLine(
                    'Class ' . $className . ' created at ' . $classFileName
            );
        } else {
            $this->console->writeLine(
                    'Class ' . $className
                    . ' already exists, skipped creating the class'
            );
        }
    }