public function loadMetadataForClass(\ReflectionClass $class)
 {
     $classMetadata = new ClassMetadata($name = $class->getName());
     $classMetadata->fileResources[] = $class->getFilename();
     $exclusionPolicy = 'NONE';
     $excludeAll = false;
     $classAccessType = PropertyMetadata::ACCESS_TYPE_PROPERTY;
     foreach ($this->reader->getClassAnnotations($class) as $annot) {
         if ($annot instanceof ExclusionPolicy) {
             $exclusionPolicy = $annot->policy;
         } else {
             if ($annot instanceof XmlRoot) {
                 $classMetadata->xmlRootName = $annot->name;
             } else {
                 if ($annot instanceof Exclude) {
                     $excludeAll = true;
                 } else {
                     if ($annot instanceof AccessType) {
                         $classAccessType = $annot->type;
                     } else {
                         if ($annot instanceof AccessorOrder) {
                             $classMetadata->setAccessorOrder($annot->order, $annot->custom);
                         }
                     }
                 }
             }
         }
     }
     if (!$excludeAll) {
         foreach ($class->getProperties() as $property) {
             if ($property->getDeclaringClass()->getName() !== $name) {
                 continue;
             }
             $propertyMetadata = new PropertyMetadata($name, $property->getName());
             $isExclude = $isExpose = false;
             $AccessType = $classAccessType;
             $accessor = array(null, null);
             foreach ($this->reader->getPropertyAnnotations($property) as $annot) {
                 if ($annot instanceof Since) {
                     $propertyMetadata->sinceVersion = $annot->version;
                 } else {
                     if ($annot instanceof Until) {
                         $propertyMetadata->untilVersion = $annot->version;
                     } else {
                         if ($annot instanceof SerializedName) {
                             $propertyMetadata->serializedName = $annot->name;
                         } else {
                             if ($annot instanceof Expose) {
                                 $isExpose = true;
                             } else {
                                 if ($annot instanceof Exclude) {
                                     $isExclude = true;
                                 } else {
                                     if ($annot instanceof Type) {
                                         $propertyMetadata->type = $annot->name;
                                     } else {
                                         if ($annot instanceof XmlList) {
                                             $propertyMetadata->xmlCollection = true;
                                             $propertyMetadata->xmlCollectionInline = $annot->inline;
                                             $propertyMetadata->xmlEntryName = $annot->entry;
                                         } else {
                                             if ($annot instanceof XmlMap) {
                                                 $propertyMetadata->xmlCollection = true;
                                                 $propertyMetadata->xmlCollectionInline = $annot->inline;
                                                 $propertyMetadata->xmlEntryName = $annot->entry;
                                                 $propertyMetadata->xmlKeyAttribute = $annot->keyAttribute;
                                             } else {
                                                 if ($annot instanceof XmlAttribute) {
                                                     $propertyMetadata->xmlAttribute = true;
                                                 } else {
                                                     if ($annot instanceof XmlValue) {
                                                         $propertyMetadata->xmlValue = true;
                                                     } else {
                                                         if ($annot instanceof AccessType) {
                                                             $AccessType = $annot->type;
                                                         } else {
                                                             if ($annot instanceof Accessor) {
                                                                 $accessor = array($annot->getter, $annot->setter);
                                                             } else {
                                                                 if ($annot instanceof Groups) {
                                                                     $propertyMetadata->setGroups($annot->names);
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             $propertyMetadata->setAccessor($AccessType, $accessor[0], $accessor[1]);
             if (ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude || ExclusionPolicy::ALL === $exclusionPolicy && $isExpose) {
                 $classMetadata->addPropertyMetadata($propertyMetadata);
             }
         }
     }
     foreach ($class->getMethods() as $method) {
         if ($method->getDeclaringClass()->getName() !== $name) {
             continue;
         }
         foreach ($this->reader->getMethodAnnotations($method) as $annot) {
             if ($annot instanceof PreSerialize) {
                 $classMetadata->addPreSerializeMethod(new MethodMetadata($name, $method->getName()));
                 continue 2;
             } else {
                 if ($annot instanceof PostDeserialize) {
                     $classMetadata->addPostDeserializeMethod(new MethodMetadata($name, $method->getName()));
                     continue 2;
                 } else {
                     if ($annot instanceof PostSerialize) {
                         $classMetadata->addPostSerializeMethod(new MethodMetadata($name, $method->getName()));
                         continue 2;
                     }
                 }
             }
         }
     }
     return $classMetadata;
 }