private function getCollectionDefinition($name, array $defaultDefinition = null)
    {
        if (isset($this->mapping[$name])) {
            $classDefinition = $this->mapping[$name];
        } elseif ($this->regexpMapping) {
            foreach ($this->regexpMapping as $collectionNamePattern => $regexpMappingClassDefinition) {
                if (preg_match($collectionNamePattern, $name, $matches)) {
                    $classDefinition = clone $regexpMappingClassDefinition;
                    $classDefinition->setOption('regexp', $matches);
                    break;
                }
            }
        }

        // mapping not configured - use default
        if (!isset($classDefinition)) {
            if (!empty($this->mapping['*'])) {
                $classDefinition = clone $this->mapping['*'];
                $collectionClass = $classDefinition->getClass()
                    . '\\'
                    . implode('\\', array_map('ucfirst', explode('.', $name)));
                $classDefinition->setClass($collectionClass);
            } else {
                $classDefinition = new Definition();
                if ($defaultDefinition) {
                    $classDefinition->merge($defaultDefinition);
                }
            }
        }

        // check if class exists
        if (!class_exists($classDefinition->getClass())) {
            throw new Exception(
                'Class ' . $classDefinition->getClass() . ' not found while map collection name to class'
            );
        }

        return $classDefinition;
    }