Class CastingInjector<T>

  • Type Parameters:
    T - the type to which the argument should be cast
    All Implemented Interfaces:
    Injector<java.lang.Object>

    public final class CastingInjector<T>
    extends java.lang.Object
    implements Injector<java.lang.Object>
    An injector which casts the value to a specific type.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Injector<T> target  
      private java.lang.Class<T> type  
    • Constructor Summary

      Constructors 
      Constructor Description
      CastingInjector​(Injector<T> target, java.lang.Class<T> type)
      Construct a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void inject​(java.lang.Object value)
      Inject the given value.
      void uninject()
      Uninject the given value (in other words, cancel or undo a previous injection).
      • Methods inherited from class java.lang.Object

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

      • type

        private final java.lang.Class<T> type
    • Constructor Detail

      • CastingInjector

        public CastingInjector​(Injector<T> target,
                               java.lang.Class<T> type)
        Construct a new instance.
        Parameters:
        target - the injection target
        type - the type to cast to
    • Method Detail

      • uninject

        public void uninject()
        Uninject the given value (in other words, cancel or undo a previous injection). Only called after inject() has been called.
        Specified by:
        uninject in interface Injector<T>