protected function buildMap(array $metadata)
    {
        $className = $this->getMapClassName();
        $map = new $className($metadata['class']);

        foreach ($metadata['definitions'] as $metadataDefinition) {
            $definition = $this->buildDefinition($metadataDefinition);
            $map->addDefinition($definition);
        }

        return $map;
    }