/**
  * {@inheritdoc}
  */
 public function loadMetadataForClass(\ReflectionClass $class)
 {
     $annotations = $this->reader->getClassAnnotations($class);
     if (0 === count($annotations)) {
         return null;
     }
     $classMetadata = new ClassMetadata($class->getName());
     $classMetadata->fileResources[] = $class->getFileName();
     foreach ($annotations as $annotation) {
         if ($annotation instanceof Annotation\Resource) {
             // auto transform type from class name
             if (!$annotation->type) {
                 $annotation->type = StringUtil::dasherize($class->getShortName());
             }
             $classMetadata->setResource(new Resource($annotation->type, $annotation->showLinkSelf));
         }
     }
     $classProperties = $class->getProperties();
     foreach ($classProperties as $property) {
         $annotations = $this->reader->getPropertyAnnotations($property);
         foreach ($annotations as $annotation) {
             if ($annotation instanceof Annotation\Id) {
                 $classMetadata->setIdField($property->getName());
             } else {
                 if ($annotation instanceof Annotation\Relationship) {
                     $classMetadata->addRelationship(new Relationship($property->getName(), $annotation->includeByDefault, $annotation->showData, $annotation->showLinkSelf, $annotation->showLinkRelated));
                 }
             }
         }
     }
     return $classMetadata;
 }
 /**
  * @param array            $config
  * @param \ReflectionClass $class
  *
  * @return Resource
  */
 protected function parseResource(array $config, \ReflectionClass $class)
 {
     if (isset($config['resource'])) {
         $resource = $config['resource'];
         return new Resource(isset($resource['type']) ? $resource['type'] : StringUtil::dasherize($class->getShortName()), isset($resource['showLinkSelf']) ? $resource['showLinkSelf'] : null);
     }
     return new Resource(StringUtil::dasherize($class->getShortName()));
 }