public function addField(Field $field)
    {
        $name = $field->getName();
        if (array_key_exists($name, $this->fields)) {
            throw new DuplicateFieldNameException($name);
        }
        $this->fields[$name] = $field;
        foreach ($field->getAliases() as $alias) {
            if (array_key_exists($alias, $this->fieldAliases)) {
                throw new DuplicateFieldAliasException($alias);
            }
            $this->fieldAliases[$alias] = $name;
        }

        return $this;
    }