public function instantiateAnnotation(Customweb_Annotation_Cache_Annotation $cacheInstance, $targetReflection = false)
 {
     $class = Customweb_Annotation_Util::resolveClassName($cacheInstance->getName());
     $parameters = $this->instanciateNestedAnnotations($cacheInstance->getParameters());
     if (Customweb_Core_Util_Class::isClassLoaded($class) && !Customweb_Annotation_Util::ignores($class)) {
         $annotationReflection = new ReflectionClass($class);
         $instance = $annotationReflection->newInstance();
         if (method_exists($instance, 'setData')) {
             $instance->setData($parameters);
         } else {
             set_error_handler(array($this, 'handleInstanciationErrors'));
             try {
                 foreach ($parameters as $propertyName => $propertyValue) {
                     $methodName = 'set' . $propertyName;
                     if (method_exists($instance, $methodName)) {
                         $instance->{$methodName}($propertyValue);
                     } elseif (property_exists($instance, $propertyName)) {
                         $instance->{$propertyName} = $propertyValue;
                     } else {
                         throw new Exception(Customweb_Core_String::_("Property @property could not be set on annotation class @class")->format(array('@class' => $class, '@property' => $propertyName)));
                     }
                 }
             } catch (Exception $e) {
                 restore_error_handler();
                 throw $e;
             }
             restore_error_handler();
         }
         if (method_exists($instance, 'checkConstraints')) {
             $instance->checkConstraints($targetReflection);
         }
         return $instance;
     }
     return false;
 }
 public function getAllAnnotations($restriction = false)
 {
     $restriction = Customweb_Annotation_Util::resolveClassName($restriction);
     $result = array();
     foreach ($this->annotations as $class => $instances) {
         if (!$restriction || $restriction == $class) {
             $result = array_merge($result, $instances);
         }
     }
     return $result;
 }