Gets a specfied annotation on a specified document page.

@param integer $pageNumber Number of the page.
@param integer $annotationIndex Index of th annotation.

@return object
@throws Exception
497074
public function getAnnotation($pageNumber, $annotationIndex)
    {

        $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/pages/' . $pageNumber . '/annotations/' . $annotationIndex;
        $signedURI = Utils::sign($strURI);
        $responseStream = Utils::processCommand($signedURI, 'GET', '', '');
        $json = json_decode($responseStream);
        return $json->Annotation;
    }
826740
private function getArticleForPage(ArticleDocument $article, $pageNumber)
    {
        $children = $article->getChildren();
        if (null === $children || 1 === $pageNumber) {
            return $article;
        }

        foreach ($children as $child) {
            if ($child instanceof ArticlePageDocument && $child->getPageNumber() === $pageNumber) {
                return $child;
            }
        }

        return $article;
    }
426895
public static function getPropertyAnnotation(\ReflectionProperty $property, $annotationClass, AnnotationReader $reader)
    {
        return $reader->getPropertyAnnotation($property, $annotationClass);
    }
1029319
public static function collect(string $className, $objectAnnotation = null, string $propertyName = "", string $methodName = "", $propertyValue = null)
    {
        if ($objectAnnotation instanceof Process) {

            $num       = $objectAnnotation->getNum();
            $name      = $objectAnnotation->getName();
            $boot      = $objectAnnotation->isBoot();
            $inout     = $objectAnnotation->isInout();
            $pipe      = $objectAnnotation->isPipe();
            $coroutine = $objectAnnotation->isCoroutine();
            $name      = empty($name) ? $className : $name;

            self::$processes[$name] = [
                'name'  => $name,
                'num'   => $num,
                'boot'  => $boot,
                'pipe'  => $pipe,
                'inout' => $inout,
                'co'    => $coroutine,
                'class' => $className,
            ];

            return;
        }
    }
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;
    }
1104328
public function getReader()
    {
        if ($this->reader) {
            return $this->reader;
        }

        $className = $this->getDoctrineAnnotationReaderClassName();

        $r = new ReflectionClass($className);

        $instance = $r->newInstance();

        if (!$instance instanceof DoctrineAnnotationsReaderInterface) {
            $errMsg = sprintf('Reader not implement %s', DoctrineAnnotationsReaderInterface::class);
            throw new Exception\InvalidDoctrineAnnotationsReaderException($errMsg);
        }

        $this->reader = $instance;

        return $this->reader;
    }
552002
public static function getAnnotationReader()
    {
        if (self::$annotationReader === null) {
            self::$annotationReader = new CachedReader(new AnnotationReader(), new ArrayCache());
        }

        return self::$annotationReader;
    }
689472
@SuppressWarnings("unchecked")
    public <A extends Annotation> A getAnnotation(final Field field, final Class<A> annClass) throws AnnotationReadException {
        
        final Class<?> clazz = field.getDeclaringClass();
        
        if(xmlInfo != null && xmlInfo.containsClassInfo(clazz.getName())) {
            final ClassInfo classInfo = xmlInfo.getClassInfo(clazz.getName());
            
            if(classInfo.containsFieldInfo(field.getName())) {
                FieldInfo fieldInfo = classInfo.getFieldInfo(field.getName());
                if(fieldInfo != null && fieldInfo.containsAnnotationInfo(annClass.getName())){
                    AnnotationInfo annInfo = fieldInfo.getAnnotationInfo(annClass.getName());
                    try {
                        return (A)annotationBuilder.buildAnnotation(Class.forName(annInfo.getClassName()), annInfo);
                    } catch (ClassNotFoundException e) {
                        throw new AnnotationReadException(String.format("not found class '%s'", annInfo.getClassName()), e);
                    }
                }
            }
        }
        return field.getAnnotation(annClass);
    }
466027
public static function set_annotations($gradeid, $pageno, $annotations) {
        global $DB;

        $DB->delete_records('assignfeedback_editpdf_annot', array('gradeid' => $gradeid, 'pageno' => $pageno, 'draft' => 1));
        $added = 0;
        foreach ($annotations as $record) {
            // Force these.
            if (!($record instanceof annotation)) {
                $annotation = new annotation($record);
            } else {
                $annotation = $record;
            }
            $annotation->gradeid = $gradeid;
            $annotation->pageno = $pageno;
            $annotation->draft = 1;
            if (self::add_annotation($annotation)) {
                $added++;
            }
        }

        return $added;
    }
266008
public function parser(string $className, $objectAnnotation = null, string $propertyName = "", string $methodName = "", $propertyValue = null)
    {
        $injectValue = $objectAnnotation->getName();
        if (!empty($injectValue)) {
            return [$injectValue, true];
        }

        // phpdoc解析
        $phpReader = new PhpDocReader();
        $property = new \ReflectionProperty($className, $propertyName);
        $propertyClass = $phpReader->getPropertyClass($property);

        $isRef = true;
        $injectProperty = $propertyClass;
        return [$injectProperty, $isRef];
    }
54907
public function getIndirectObject($objectNumber)
    {
        $offset = $this->getOffsetFor($objectNumber);
        if ($offset === false) {
            throw new CrossReferenceException(
                \sprintf('Object (id:%s) not found.', $objectNumber),
                CrossReferenceException::OBJECT_NOT_FOUND
            );
        }

        $parser = $this->parser;

        $parser->getTokenizer()->clearStack();
        $parser->getStreamReader()->reset($offset + $this->fileHeaderOffset);

        try {
            /** @var PdfIndirectObject $object */
            $object = $parser->readValue(null, PdfIndirectObject::class);
        } catch (PdfTypeException $e) {
            throw new CrossReferenceException(
                \sprintf('Object (id:%s) not found at location (%s).', $objectNumber, $offset),
                CrossReferenceException::OBJECT_NOT_FOUND,
                $e
            );
        }

        if ($object->objectNumber !== $objectNumber) {
            throw new CrossReferenceException(
                \sprintf('Wrong object found, got %s while %s was expected.', $object->objectNumber, $objectNumber),
                CrossReferenceException::OBJECT_NOT_FOUND
            );
        }

        return $object;
    }
226214
public static function collect(string $className, $objectAnnotation = null, string $propertyName = "", string $methodName = "", $propertyValue = null)
    {
        if ($objectAnnotation instanceof Breaker) {
            $breakerName = $objectAnnotation->getName();
            $breakerName = empty($breakerName) ? $className : $breakerName;

            self::$breakers[$breakerName] = $className;
        }
    }
948815
protected function extractAnnotation(KernelEvent $event, $annotationClassName)
    {
        $controller = $this->resolver->getController($event->getRequest());
        $reflectionClass = new \ReflectionClass($controller[0]);
        $annot = $this->annotationReader->getMethodAnnotation($reflectionClass->getMethod(
            $controller[1]),
            $annotationClassName
        );

        if(!$annot) {
            $annot = $this->annotationReader->getClassAnnotation($reflectionClass, $annotationClassName);
        }

        return $annot;
    }
1013950
public static function getPropertiesByAnnotation($entityClass, $annotationClass, AnnotationReader $reader)
    {
        $properties = [];

        $reflectionClass = new ReflectionClass($entityClass);
        foreach ($reflectionClass->getProperties() as $reflectionProperty) {

            if (false === self::hasPropertyAnnotation($reflectionProperty, $annotationClass, $reader)) {
                continue;
            }

            $reflectionProperty->setAccessible(true);

            $properties[] = $reflectionProperty;
        }

        return $properties;
    }
567482
public static function getMethodsAnnotations($className, $annotationClassName = null)
    {
        if(null === $annotationClassName)
        {
            return static::$annotations[$className]['Methods'] ?? [];
        }
        $result = [];
        foreach(static::$annotations[$className]['Methods'] ?? [] as $methodName => $annotations)
        {
            foreach($annotations as $annotation)
            {
                if($annotation instanceof $annotationClassName)
                {
                    $result[$methodName][] = $annotation;
                }
            }
        }
        return $result;
    }
1360591
public static function readMethod( $method , $annotation = null ) {

		$ref = $method instanceof ReflectionMethod ? $method : new ReflectionMethod( $method[0] , $method[1] );

		return $annotation ? static::reader()->getMethodAnnotation( $ref , $annotation ) : static::reader()->getMethodAnnotations( $ref );

	}
1313489
public function parser(string $className, $objectAnnotation = null, string $propertyName = "", string $methodName = "", $propertyValue = null)
    {
        $beanName = $objectAnnotation->getName();
        $beanName = empty($beanName) ? $className : $beanName;
        $scope    = Scope::SINGLETON;

        DefinitionCollector::collect($className, $objectAnnotation, $propertyName, $methodName, $propertyValue);

        return [$beanName, $scope, ""];
    }