ng-xtend API documentation
    Preparing search index...

    Class XtTypeHierarchyResolver

    Default implementation of XtUpdatableTypeResolver. Manages a registry of type hierarchies and their handlers, supports adding root types, resolving references, and querying type metadata.

    Implements

    Index

    Constructors

    Properties

    types: Map<string, XtTypeHierarchy> = ...

    Map of type names to their hierarchy definitions

    Methods

    • Groups sub-properties by their type name

      Type Parameters

      • Type

      Parameters

      • typeName: string | null | undefined

        The parent type name

      Returns Map<string, (keyof Type)[]>

      A map of type names to arrays of property keys of that type

    • Finds a type reference by name within a given type

      Parameters

      • typeName: string | null | undefined

        The parent type name

      • refName: string

        The reference name to find

      Returns XtTypeReference | null | undefined

      The type reference or undefined if not found

    • Returns the list of properties of the type typeName that are compatible with the type typeOfSubProperties

      Type Parameters

      • Type

      Parameters

      • typeName: string | null | undefined
      • typeOfSubProperties: string

      Returns (keyof Type)[]

    • Finds the type handler for a given type, optionally creating a default one

      Type Parameters

      • Type

      Parameters

      • typeName: string | null | undefined

        The name of the type to find the handler for

      • OptionalcreateDefault: boolean

        If true, creates a default handler if none exists

      • OptionalsubName: string

        Optional sub-type name to resolve first

      • Optionalvalue: Type

        Optional value to help determine the type

      Returns { handler?: XtTypeHandler<Type>; typeName?: string | null }

      Object with the resolved typeName and its handler (if found)

    • Finds the type name for a given type, optionally resolving a sub-type

      Parameters

      • typeName: string | null | undefined

        The type name or null/undefined

      • OptionalsubName: string

        Optional sub-type name

      • Optionalvalue: any

        Optional value to help determine the type

      Returns string | null | undefined

      The resolved type name or undefined

    • Gets an existing type handler or creates a default one if none exists

      Type Parameters

      • Type

      Parameters

      • typeName: string | null | undefined

        The name of the type

      • OptionalsubName: string

        Optional sub-type name

      • Optionalvalue: Type

        Optional value to help determine the type

      Returns { handler?: XtTypeHandler<Type>; typeName?: string | null }

      Object with the resolved typeName and its handler

    • Checks if a type definition represents a primitive type

      Parameters

      • typeDef: string | XtTypeHierarchy | XtTypeReference | null | undefined

        The type definition (string name, hierarchy, or reference)

      • Optionalvalue: any

        Optional value to help determine primitiveness

      Returns boolean

      True if the type is primitive

    • Lists all type references for a given type

      Parameters

      • typeName: string | null | undefined

        The type name to list references for

      Returns { [key: string]: XtTypeReference }

      A map of reference names to their XtTypeReference definitions

    • Lists the names of sub-properties for a given type, optionally using a value to infer them

      Parameters

      • typeName: string | null | undefined

        The type name to list sub-properties for

      • Optionalvalue: any

        Optional value used to infer sub-properties if no type is registered

      Returns string[]

      An array of sub-property names

    • Resolves all unresolved type references in the hierarchy. Iterates over all registered types and replaces UNRESOLVED_TYPE placeholders and unresolved references with their actual resolved types.

      Returns void

      Error if a reference cannot be resolved