protected function addConstraints(XType $type, &$rule)
    {

        foreach ($type->constraints as $name=>$parameters) {

            if ($name == 'not_null') {
                continue;
            }

            if (isset($this->constraintToRule[$name])) {
                $constraintName = $this->constraintToRule[$name];
                $rule[] = $constraintName . ':' . implode($parameters);
            }

        }
    }