Process class annotation to extract infos

@param   Annotation $annotation Annotation to process
@return  void
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;
        }
    }
484864
protected function annotationToArray($annotation)
    {
        $options = array();
        foreach ((array) $annotation as $key => $value) {
            if ($value !== null) {
                $options[$key] = $value;
            }
        }

        return $options;
    }
422129
final protected function nonNullIfHasDefault(AbstractAnnotation $annotation): void
    {
        $type = $annotation->getTypeInstance();
        if ($type instanceof NonNull && $annotation->hasDefaultValue()) {
            $annotation->setTypeInstance($type->getWrappedType());
        }
    }
281603
public function process() {
        $className = new $this->_annotation['class'];
        $class = new $className();

        foreach ($this->_annotation['properties'] as $property => $value) {
            $class->$property = $value;
        }

        return $class;
    }
100925
public function execute(RequestAnnotation $annotation, PropertyParserBuilder $propertyParser)
    {
        $propertyParser->addFilter(
            FilterBuilder::builder()
            ->withClass($annotation->getAssociatedClass())
            ->withSpecification($annotation->getValue())
            ->build()
        );
    }
713723
public function handleExcludeAnnotation($e)
    {
        $annotation = $e->getParam('annotation');
        if (!$annotation instanceof Annotation\Exclude) {
            return;
        }
    
        $spec = $e->getParam($this->getEventParamName());
        $spec['exclude'] = $annotation->getExclude();
    }
1257248
public function setAnnotation($key, $annotation)
    {
        if (array_key_exists($key, $this->annotations)) {
            $this->annotations[$key] = $annotation;
        }
    }
493996
protected function extractSortInfo($sortAnnotation)
    {
        $sortInfo = ['direction' => null, 'column' => null];
        if ($sortAnnotation) {
            $direction = $sortAnnotation->direction;
            $sortInfo['direction'] = $direction;
            $column = $sortAnnotation->column;
            $sortInfo['column'] = $column;
        }

        return $sortInfo;
    }
1095365
protected function processAttributeOptions(AttributeAnnotation $annotation, Attribute $attribute)
    {
        if ($annotation->type !== null) {
            $this->processDataType($annotation->type, $attribute);
        }

        if ($annotation->many !== null) {
            $attribute->setMany($annotation->many);
        }

        if ($annotation->processNull !== null) {
            $attribute->setProcessNull($annotation->processNull);
        }
    }
1145014
private function registerAnnotations(array $annotations)
    {
        $kernel = $this
            ->container
            ->get('kernel');

        foreach ($annotations as $annotation) {
            AnnotationRegistry::registerFile($kernel
                ->locateResource($annotation)
            );
        }
    }
620982
public function matches(AbstractAnnotation $annotation) {
		if (!$annotation instanceof self) {
			return false;
		}
		if ($annotation->getType() !== $this->type) {
			return false;
		}

		return true;
	}
1122989
private function getReturnsFromAnnotation(?Annotation $annotation): array
    {
        return $this->isFilledReturnAnnotation($annotation)
            ? explode('|', preg_split('~\\s+~', $annotation->getContent())[0])
            : [];
    }
1057609
public void processAnnotations(List<JCCompilationUnit> roots,
                                   Collection<String> classnames) {
        if (shouldStop(CompileState.PROCESS)) {
            // Errors were encountered.
            // Unless all the errors are resolve errors, the errors were parse errors
            // or other errors during enter which cannot be fixed by running
            // any annotation processors.
            if (unrecoverableError()) {
                deferredDiagnosticHandler.reportDeferredDiagnostics();
                log.popDiagnosticHandler(deferredDiagnosticHandler);
                return ;
            }
        }

        // ASSERT: processAnnotations and procEnvImpl should have been set up by
        // by initProcessAnnotations

        // NOTE: The !classnames.isEmpty() checks should be refactored to Main.

        if (!processAnnotations) {
            // If there are no annotation processors present, and
            // annotation processing is to occur with compilation,
            // emit a warning.
            if (options.isSet(PROC, "only")) {
                log.warning("proc.proc-only.requested.no.procs");
                todo.clear();
            }
            // If not processing annotations, classnames must be empty
            if (!classnames.isEmpty()) {
                log.error("proc.no.explicit.annotation.processing.requested",
                          classnames);
            }
            Assert.checkNull(deferredDiagnosticHandler);
            return ; // continue regular compilation
        }

        Assert.checkNonNull(deferredDiagnosticHandler);

        try {
            List<ClassSymbol> classSymbols = List.nil();
            List<PackageSymbol> pckSymbols = List.nil();
            if (!classnames.isEmpty()) {
                 // Check for explicit request for annotation
                 // processing
                if (!explicitAnnotationProcessingRequested()) {
                    log.error("proc.no.explicit.annotation.processing.requested",
                              classnames);
                    deferredDiagnosticHandler.reportDeferredDiagnostics();
                    log.popDiagnosticHandler(deferredDiagnosticHandler);
                    return ; // TODO: Will this halt compilation?
                } else {
                    boolean errors = false;
                    for (String nameStr : classnames) {
                        Symbol sym = resolveBinaryNameOrIdent(nameStr);
                        if (sym == null ||
                            (sym.kind == PCK && !processPcks) ||
                            sym.kind == ABSENT_TYP) {
                            if (sym != silentFail)
                                log.error(Errors.ProcCantFindClass(nameStr));
                            errors = true;
                            continue;
                        }
                        try {
                            if (sym.kind == PCK)
                                sym.complete();
                            if (sym.exists()) {
                                if (sym.kind == PCK)
                                    pckSymbols = pckSymbols.prepend((PackageSymbol)sym);
                                else
                                    classSymbols = classSymbols.prepend((ClassSymbol)sym);
                                continue;
                            }
                            Assert.check(sym.kind == PCK);
                            log.warning(Warnings.ProcPackageDoesNotExist(nameStr));
                            pckSymbols = pckSymbols.prepend((PackageSymbol)sym);
                        } catch (CompletionFailure e) {
                            log.error(Errors.ProcCantFindClass(nameStr));
                            errors = true;
                            continue;
                        }
                    }
                    if (errors) {
                        deferredDiagnosticHandler.reportDeferredDiagnostics();
                        log.popDiagnosticHandler(deferredDiagnosticHandler);
                        return ;
                    }
                }
            }
            try {
                annotationProcessingOccurred =
                        procEnvImpl.doProcessing(roots,
                                                 classSymbols,
                                                 pckSymbols,
                                                 deferredDiagnosticHandler);
                // doProcessing will have handled deferred diagnostics
            } finally {
                procEnvImpl.close();
            }
        } catch (CompletionFailure ex) {
            log.error("cant.access", ex.sym, ex.getDetailValue());
            if (deferredDiagnosticHandler != null) {
                deferredDiagnosticHandler.reportDeferredDiagnostics();
                log.popDiagnosticHandler(deferredDiagnosticHandler);
            }
        }
    }
155633
public function validateDocumentAnnotation($annotation)
    {
        if (!in_array($annotation, $this->getDocumentAnnotations())) {
            throw $this->getException(
                'The document annotation isn\'t valid ("%s" given, expecting one of following: %s)',
                [$annotation, implode(', ', $this->getDocumentAnnotations())]
            );
        }

        return $annotation;
    }
1106403
public function validatePropertyAnnotation($annotation)
    {
        if (!in_array($annotation, $this->propertyAnnotations)) {
            throw $this->getException(
                'The property annotation isn\'t valid ("%s" given, expecting one of following: %s)',
                [$annotation, implode(', ', $this->propertyAnnotations)]
            );
        }

        return $annotation;
    }
144112
public function having($annotation)
    {
        $methods = [];

        foreach ($this->reflectInto($this->reference) as $method) {
            if ($this->hasAnnotation($annotation, $method)) {
                $methods[] = $method->getName();
            }
        }

        // We'll reverse the results to ensure that this package's
        // hooks are called *before* the user's.

        return array_reverse($methods);
    }
245192
def process_annotation(self, ann):
        """"""
        tmpl = self.xsl_template("@" + self.qname(ann))
        ET.SubElement(tmpl, "param", name="level", select="0")
        ct = self.xsl_calltemplate("leaf", tmpl)
        ET.SubElement(ct, "with-param", name="level", select="$level")
        self.xsl_withparam("nsid", ann.i_module.i_modulename + ":", ct)
        self.type_param(ann, ct)