Class ComponentWithConstructorInjection

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getData()
      Returns the component's data
      void printData()
      Prints the component's data using the injected print service
      void setData​(java.lang.String data)
      Sets the component's data
      • Methods inherited from class java.lang.Object

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

      • ComponentWithConstructorInjection

        public ComponentWithConstructorInjection​(PrintService printService)
        Constructor, only used by the framework, allows DEPENDENCY INJECTION
        Parameters:
        printService - injected reference to print service
    • Method Detail

      • getData

        public java.lang.String getData()
        Description copied from interface: Component
        Returns the component's data
        Specified by:
        getData in interface Component
        Returns:
        data
      • setData

        public void setData​(java.lang.String data)
        Description copied from interface: Component
        Sets the component's data
        Specified by:
        setData in interface Component
        Parameters:
        data - component data
      • printData

        public void printData()
        Description copied from interface: Component
        Prints the component's data using the injected print service
        Specified by:
        printData in interface Component