public function xType($root, $path=null)
    {

        $class = is_object($root) ? get_class($root): $root;

        $isClass = is_string($class) && class_exists($class);

        if ($isClass && $type = $this->getClassXType($root, $class, $path)) {
            return $type;
        }

        if (!$isClass) {
            $value = $path ? $this->extractor->value($root, $path) : $root;
            return $this->templateFactory->toType($value);
        }

        // If the class exists but not the path dont return fake types
        if (isset($this->classCache[$class]) && $path) {
            return null;
        }

        $nativeType = $this->extractor->type($root, $path);

        return $this->nativeToXType($nativeType);

    }