Class Composite.Injector

java.lang.Object
org.simpleframework.xml.core.Composite.Builder
org.simpleframework.xml.core.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 Details

    • 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 Details

    • read

      public Object read(InputNode node) throws 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:
      Exception
    • readInject

      private Object readInject(InputNode node) throws 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:
      Exception