Class StateComponentMapping<TComponent>

Used by the EntityState class to create the mappings of components to providers via a fluent interface.

Type Parameters

  • TComponent

Hierarchy

  • StateComponentMapping

Constructors

  • Used internally, the constructor creates a component mapping. The constructor creates a ComponentTypeProvider as the default mapping, which will be replaced by more specific mappings if other methods are called.

    Type Parameters

    • TComponent

    Parameters

    • creatingState: EntityState

      The EntityState that the mapping will belong to

    • type: Class<TComponent>

      The component type for the mapping

    Returns StateComponentMapping<TComponent>

Methods

  • Maps through to the add method of the EntityState that this mapping belongs to so that a fluent interface can be used when configuring entity states.

    Type Parameters

    • TNextComponent

    Parameters

    • type: Class<TNextComponent>

      The type of component to add a mapping to the state for

    Returns StateComponentMapping<TNextComponent>

    The new ComponentMapping for that type

  • Creates a mapping for the component type to a specific component instance. A ComponentInstanceProvider is used for the mapping.

    Parameters

    • component: TComponent

      The component instance to use for the mapping

    Returns StateComponentMapping<TComponent>

    This ComponentMapping, so more modifications can be applied

  • Creates a mapping for the component type to a method call. A DynamicComponentProvider is used for the mapping.

    Parameters

    • method: (() => TComponent)

      The method to return the component instance

        • (): TComponent
        • Returns TComponent

    Returns StateComponentMapping<TComponent>

    This ComponentMapping, so more modifications can be applied

  • Creates a mapping for the component type to a single instance of the provided type. The instance is not created until it is first requested. The type should be the same as or extend the type for this mapping. A ComponentSingletonProvider is used for the mapping.

    Parameters

    • type: Class<any> = ...

      of the single instance to be created. If omitted, the type of the mapping is used.

    Returns StateComponentMapping<TComponent>

    This ComponentMapping, so more modifications can be applied

  • Creates a mapping for the component type to new instances of the provided type. The type should be the same as or extend the type for this mapping. A ComponentTypeProvider is used for the mapping.

    Parameters

    • type: Class<TComponent>

      The type of components to be created by this mapping

    Returns StateComponentMapping<TComponent>

    This ComponentMapping, so more modifications can be applied

Generated using TypeDoc