@param Annotation\Annotation[] $classAnnotations

@throws ReflectionException
@throws Mapping\MappingException
344874
private function attachEntityListeners(
        array $classAnnotations,
        ReflectionClass $reflectionClass,
        Mapping\ClassMetadata $metadata
    ) : void {
        // Evaluate @EntityListeners annotation
        if (isset($classAnnotations[Annotation\EntityListeners::class])) {
            /** @var Annotation\EntityListeners $entityListenersAnnot */
            $entityListenersAnnot = $classAnnotations[Annotation\EntityListeners::class];

            foreach ($entityListenersAnnot->value as $listenerClassName) {
                if (! class_exists($listenerClassName)) {
                    throw Mapping\MappingException::entityListenerClassNotFound(
                        $listenerClassName,
                        $metadata->getClassName()
                    );
                }

                $listenerClass = new ReflectionClass($listenerClassName);

                /** @var ReflectionMethod $method */
                foreach ($listenerClass->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
                    foreach ($this->getMethodCallbacks($method) as $callback) {
                        $metadata->addEntityListener($callback, $listenerClassName, $method->getName());
                    }
                }
            }
        }
    }
412241
private function convertClassAnnotationsToEntityClassMetadata(
        array $classAnnotations,
        ReflectionClass $reflectionClass,
        Mapping\ClassMetadata $metadata,
        Mapping\ClassMetadataBuildingContext $metadataBuildingContext
    ) {
        /** @var Annotation\Entity $entityAnnot */
        $entityAnnot = $classAnnotations[Annotation\Entity::class];

        if ($entityAnnot->repositoryClass !== null) {
            $metadata->setCustomRepositoryClassName($entityAnnot->repositoryClass);
        }

        if ($entityAnnot->readOnly) {
            $metadata->asReadOnly();
        }

        $metadata->isMappedSuperclass = false;
        $metadata->isEmbeddedClass    = false;

        $this->attachTable($classAnnotations, $reflectionClass, $metadata, $metadataBuildingContext);

        // Evaluate @ChangeTrackingPolicy annotation
        if (isset($classAnnotations[Annotation\ChangeTrackingPolicy::class])) {
            $changeTrackingAnnot = $classAnnotations[Annotation\ChangeTrackingPolicy::class];

            $metadata->setChangeTrackingPolicy(
                constant(sprintf('%s::%s', Mapping\ChangeTrackingPolicy::class, $changeTrackingAnnot->value))
            );
        }

        // Evaluate @InheritanceType annotation
        if (isset($classAnnotations[Annotation\InheritanceType::class])) {
            $inheritanceTypeAnnot = $classAnnotations[Annotation\InheritanceType::class];

            $metadata->setInheritanceType(
                constant(sprintf('%s::%s', Mapping\InheritanceType::class, $inheritanceTypeAnnot->value))
            );

            if ($metadata->inheritanceType !== Mapping\InheritanceType::NONE) {
                $this->attachDiscriminatorColumn($classAnnotations, $reflectionClass, $metadata, $metadataBuildingContext);
            }
        }

        $this->attachLifecycleCallbacks($classAnnotations, $reflectionClass, $metadata);
        $this->attachEntityListeners($classAnnotations, $reflectionClass, $metadata);

        return $metadata;
    }
1322238
private function convertClassAnnotationsToClassMetadata(
        array $classAnnotations,
        ReflectionClass $reflectionClass,
        Mapping\ClassMetadata $metadata,
        Mapping\ClassMetadataBuildingContext $metadataBuildingContext
    ) : Mapping\ClassMetadata {
        switch (true) {
            case isset($classAnnotations[Annotation\Entity::class]):
                return $this->convertClassAnnotationsToEntityClassMetadata(
                    $classAnnotations,
                    $reflectionClass,
                    $metadata,
                    $metadataBuildingContext
                );

                break;

            case isset($classAnnotations[Annotation\MappedSuperclass::class]):
                return $this->convertClassAnnotationsToMappedSuperClassMetadata(
                    $classAnnotations,
                    $reflectionClass,
                    $metadata
                );
            case isset($classAnnotations[Annotation\Embeddable::class]):
                return $this->convertClassAnnotationsToEmbeddableClassMetadata(
                    $classAnnotations,
                    $reflectionClass,
                    $metadata
                );
            default:
                throw Mapping\MappingException::classIsNotAValidEntityOrMappedSuperClass($reflectionClass->getName());
        }
    }
1007822
private function attachDiscriminatorColumn(
        array $classAnnotations,
        ReflectionClass $reflectionClass,
        Mapping\ClassMetadata $metadata
    ) : void {
        $discriminatorColumn = new Mapping\DiscriminatorColumnMetadata();

        $discriminatorColumn->setTableName($metadata->getTableName());
        $discriminatorColumn->setColumnName('dtype');
        $discriminatorColumn->setType(Type::getType('string'));
        $discriminatorColumn->setLength(255);

        // Evaluate DiscriminatorColumn annotation
        if (isset($classAnnotations[Annotation\DiscriminatorColumn::class])) {
            /** @var Annotation\DiscriminatorColumn $discriminatorColumnAnnotation */
            $discriminatorColumnAnnotation = $classAnnotations[Annotation\DiscriminatorColumn::class];
            $typeName                      = ! empty($discriminatorColumnAnnotation->type)
                ? $discriminatorColumnAnnotation->type
                : 'string';

            $discriminatorColumn->setType(Type::getType($typeName));
            $discriminatorColumn->setColumnName($discriminatorColumnAnnotation->name);

            if (! empty($discriminatorColumnAnnotation->columnDefinition)) {
                $discriminatorColumn->setColumnDefinition($discriminatorColumnAnnotation->columnDefinition);
            }

            if (! empty($discriminatorColumnAnnotation->length)) {
                $discriminatorColumn->setLength($discriminatorColumnAnnotation->length);
            }
        }

        $metadata->setDiscriminatorColumn($discriminatorColumn);

        // Evaluate DiscriminatorMap annotation
        if (isset($classAnnotations[Annotation\DiscriminatorMap::class])) {
            $discriminatorMapAnnotation = $classAnnotations[Annotation\DiscriminatorMap::class];
            $discriminatorMap           = $discriminatorMapAnnotation->value;

            $metadata->setDiscriminatorMap($discriminatorMap);
        }
    }
432067
public function validateEmbeddedClass($class, $classAnnotations)
    {
        $check = false;

        foreach ($classAnnotations as $annotation) {
            if ($annotation instanceof \ProAI\Datamapper\Annotations\Embeddable) {
                $check = true;
            }
        }

        if (! $check) {
            throw new InvalidArgumentException('Embedded class '.$class.' has no @Embeddable annotation.');
        }
    }
19424
private function processClassAnnotation($annotation)
    {
        $class = get_class($annotation);
        switch ($class) {
            case "JPC\MongoDB\ODM\Annotations\Mapping\Document":
                $this->collectionInfo->setCollection($annotation->collectionName);

                if (null !== ($rep = $annotation->repositoryClass)) {
                    $this->collectionInfo->setRepository($annotation->repositoryClass);
                } else {
                    if (class_exists($this->getName() . 'Repository')) {
                        $this->collectionInfo->setRepository($this->getName() . 'Repository');
                    } else {
                        $this->collectionInfo->setRepository("JPC\MongoDB\ODM\Repository");
                    }
                }

                if (null !== ($rep = $annotation->hydratorClass)) {
                    $this->collectionInfo->setHydrator($annotation->hydratorClass);
                } else {
                    $this->collectionInfo->setHydrator("JPC\MongoDB\ODM\Hydrator");
                }

                $this->checkCollectionCreationOptions($annotation);
                break;
            case "JPC\MongoDB\ODM\GridFS\Annotations\Mapping\Document":
                $this->collectionInfo->setBucketName($annotation->bucketName);
                $this->collectionInfo->setCollection($annotation->bucketName . ".files");

                if (null !== ($rep = $annotation->repositoryClass)) {
                    $this->collectionInfo->setRepository($annotation->repositoryClass);
                } else {
                    $this->collectionInfo->setRepository("JPC\MongoDB\ODM\GridFS\Repository");
                }

                if (null !== ($rep = $annotation->hydratorClass)) {
                    $this->collectionInfo->setHydrator($annotation->hydratorClass);
                } else {
                    $this->collectionInfo->setHydrator("JPC\MongoDB\ODM\GridFS\Hydrator");
                }
                break;
            case "JPC\MongoDB\ODM\Annotations\Mapping\Option":
                $this->processOptionAnnotation($annotation);
                break;
            case "JPC\MongoDB\ODM\Annotations\Event\HasLifecycleCallbacks":
                $this->hasEvent = true;
                break;
        }
    }
429328
public function updateClassNames(&$classes)
    {
        if (!$this->apply()) {
            return;
        }
        
        $classes[] = $this->style('button');
        
        if ($class = $this->owner->ButtonTypeClass) {
            $classes[] = $class;
        }
        
        if ($class = $this->owner->ButtonSizeClass) {
            $classes[] = $class;
        }
    }
1270843
protected function scanAnnotations()
    {
        $scans = $this->classesToScan();

        if (empty($scans)) {
            return;
        }

        $scanner = $this->getAnnotationScanner();

        $scanner->setClassesToScan($scans);

        $scanner->scan();
    }
49778
public void setAnnotations(java.util.Map<String, java.util.List<ValueWithServiceIds>> annotations) {
        this.annotations = annotations;
    }
368993
public function setClasses($classes)
    {
        if (!is_array($classes)) {
            $classes = $classes ? array($classes) : array();
        }
        $this->modelClasses = $classes;
    }
1257248
public function setAnnotation($key, $annotation)
    {
        if (array_key_exists($key, $this->annotations)) {
            $this->annotations[$key] = $annotation;
        }
    }
901187
public function getClassAnnotations($className, $annotationClassName = null)
    {
        $className = $this->prepareClassReflectionForUsage($className);

        $annotationClassName = $annotationClassName === null ? null : $this->cleanClassName($annotationClassName);
        if (!isset($this->classReflectionData[$className][self::DATA_CLASS_ANNOTATIONS])) {
            return [];
        }
        if ($annotationClassName === null) {
            return $this->classReflectionData[$className][self::DATA_CLASS_ANNOTATIONS];
        }

        $annotations = [];
        foreach ($this->classReflectionData[$className][self::DATA_CLASS_ANNOTATIONS] as $annotation) {
            if ($annotation instanceof $annotationClassName) {
                $annotations[] = $annotation;
            }
        }

        return $annotations;
    }
1000329
private void populateAnnotations(Collection<Annotation> annotations) {
        for (Annotation each : annotations) {
            this.annotations.put(each.annotationType(), each);
        }
    }
614258
public function registerAnnotations()
    {
        $app = $this->app;

        $loader = new AnnotationLoader($app['files'], __DIR__ . '/../Annotations');

        $loader->registerAll();
    }
1089113
public function getClassAnnotations()
    {
        if (empty($this->_annotations['class'])) {
            $comment = $this->_getReflection()->getDocComment();
            $data = AnnotationParser::getAnnotations($comment);
            $classAnnotations = new AnnotationsList();
            foreach ($data as $name => $parsedData) {
                $classAnnotations->append(
                    $this->_createAnnotation($name, $parsedData)
                );
            }
            $this->_annotations['class'] = $classAnnotations;
        }
        return $this->_annotations['class'];
    }
115327
protected function getAnnotations(
        array $annotations,
        array $arguments = array()
    ) {
        $options = array();
        foreach ($annotations as $params) {
            foreach ($params as $param) {
                if ($param instanceof SecureParam) {
                    /** @var $param SecureParam */
                    $options['secureParams'][$param->name] = $this->annotationToArray($param);
                    /* @var $argument \ReflectionParameter */
                    $argument = $arguments[$param->name];
                    $class    = $argument->getClass();
                    if (!$class) {
                        throw new \InvalidArgumentException(sprintf(
                            'Secured action parameter has no class definition'
                        ));
                    }

                    $options['secureParams'][$param->name]['class'] = $class->getName();
                } else {
                    if ($param instanceof Secure || $param instanceof Menu || $param instanceof MenuDefault) {
                        $options += $this->annotationToArray($param);
                    }
                }
            }
        }

        foreach ($annotations as $params) {
            foreach ($params as $param) {
                if ($param instanceof ParamConverter && isset($options['secureParams'][$param->getName()])) {
                    /** @var $param ParamConverter*/
                    $options['secureParams'][$param->getName()]['class'] = $param->getClass();
                }
            }
        }

        return $options;
    }
340006
protected function _callAnnotation(Controller &$class, $annotation = [], $type = 'class', $annotationType = 'Before') {
        foreach ($annotation[$type] as $action => $annotationClasses) {
            foreach ($annotationClasses as $annotationClass) {
                if ($annotationClass['annotation'] == $annotationType) {
                    /** @var \Gcs\Framework\Core\Annotation\Annotations\Common\Before $instance */
                    $instance = $annotationClass['instance'];

                    $className = $instance->class;
                    $methodName = $instance->method;

                    if (method_exists($className, $methodName)) {
                        if ($className == get_class($class)) {
                            $class->$methodName();
                        }
                        else {
                            $reflectionMethod = new \ReflectionMethod($className, $methodName);
                            echo $reflectionMethod->invoke(new $className());
                        }
                    }
                    else {
                        throw new MissingMethodException('The method "' . $methodName . '" from the class "' . $className . '" does not exist');
                    }
                }
            }
        }
    }