Class Injector


  • public class Injector
    extends java.lang.Object
    The Injector class is responsible for loading implementation based on a interface. The mappings from the interface to implementation must be loaded prior to that.
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Anar Huseynov, Erwin de Ley
    Pt.AcceptedRating:
    Red (ahuseyno)
    Pt.ProposedRating:
    Red (ahuseyno)
    • Constructor Summary

      Constructors 
      Constructor Description
      Injector()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> T getInstance​(java.lang.Class<T> type)
      Get implementation for the provided interface based on the mappings loaded into the injector.
      void loadMappings​(PtolemyModule module)
      Load the interface to implementation mappings into the injector.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Injector

        public Injector()
    • Method Detail

      • getInstance

        public <T> T getInstance​(java.lang.Class<T> type)
        Get implementation for the provided interface based on the mappings loaded into the injector. Class is the implementation.
        Parameters:
        type - The interface type to load.
        Returns:
        The implementation of the interface.
      • loadMappings

        public void loadMappings​(PtolemyModule module)
        Load the interface to implementation mappings into the injector.
        Parameters:
        module - The interface to implementation mapping.