Interface IInstanceRegistry<T>

Type Parameters:
T - the instance type

@NonExtendable public interface IInstanceRegistry<T>
Registry for attaching object instances to a type and its subtypes.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(Class<?> bound, T instance, int priority)
    Registers an instance.
    static <T> IInstanceRegistry<T>
    Creates an instance registry.
    static <T> IInstanceRegistry<T>
    Creates an instance registry with the priority comparison reversed.
    get(Object target)
    Returns the instances that apply to the target sorted by their priority.
  • Method Details

    • create

      static <T> IInstanceRegistry<T> create()
      Creates an instance registry.
    • createReversed

      static <T> IInstanceRegistry<T> createReversed()
      Creates an instance registry with the priority comparison reversed.
    • add

      void add(Class<?> bound, T instance, int priority)
      Registers an instance.
      Parameters:
      bound - the upper bound type for the instance to apply
      instance - the instance
      priority - the priority
    • get

      Returns the instances that apply to the target sorted by their priority.