Class Composite.Injector

  • Enclosing class:
    Composite

    private class Composite.Injector
    extends Composite.Builder
    This takes the approach that the objects are deserialized first then the instance is created using a constructor. In order for the best constructor to be found all the potential objects need to be deserialized first, then based on what has been deserialized a constructor is chosen and the parameters are injected in to it.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Injector​(Composite composite, Criteria criteria, Schema schema, Instance value)
      Constructor for the Injector object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object read​(InputNode node)
      This read method performs deserialization of the XML schema class type by traversing the contacts and using details from the provided XML element.
      private java.lang.Object readInject​(InputNode node)
      This readInject method performs deserialization of the XML schema class type by traversing the contacts and creating them using details from the provided XML element.
      • Methods inherited from class java.lang.Object

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

      • Injector

        private Injector​(Composite composite,
                         Criteria criteria,
                         Schema schema,
                         Instance value)
        Constructor for the Injector object. This creates a builder object capable of instantiating a object using a constructor. It injects the constructor parameters in to the constructor by using the deserialized objects.
        Parameters:
        composite - this is the composite object used by this
        criteria - this collects the objects being deserialized
        schema - this is the class schema used by this
        value - this is the instance created by the strategy
    • Method Detail

      • read

        public java.lang.Object read​(InputNode node)
                              throws java.lang.Exception
        This read method performs deserialization of the XML schema class type by traversing the contacts and using details from the provided XML element. Here an instance is instantiated only after everything has been deserialized so that the instances can be injected in to a constructor.
        Overrides:
        read in class Composite.Builder
        Parameters:
        node - the XML element that will be deserialized by this
        Returns:
        this returns the fully deserialized object graph
        Throws:
        java.lang.Exception
      • readInject

        private java.lang.Object readInject​(InputNode node)
                                     throws java.lang.Exception
        This readInject method performs deserialization of the XML schema class type by traversing the contacts and creating them using details from the provided XML element. Because this will convert a non-primitive value it delegates to other converters to perform deserialization of lists and primitives.

        This takes the approach of reading the elements and attributes before instantiating the object. Instantiation is performed using a declared constructor. The parameters are taken from the deserialized objects.

        Parameters:
        node - the XML element that will be deserialized by this
        Returns:
        this returns the fully deserialized object graph
        Throws:
        java.lang.Exception