The ConverterFactory is used to instantiate objects based on a provided type or annotation. This provides a single point of creation for all converters within the framework. For performance all the instantiated converters are cached against the class for that converter. This ensures the converters can be acquired without the overhead of instantiation.
Example #1
0
 /// <summary>
 /// Constructor for the <c>RegistryBinder</c> object. This
 /// is used to create bindings between classes and the converters
 /// that should be used to serialize and deserialize the instances.
 /// All converters are instantiated once and cached for reuse.
 /// </summary>
 public RegistryBinder() {
    this.factory = new ConverterFactory();
    this.cache = new ClassCache();
 }
Example #2
0
 /// <summary>
 /// Constructor for the <c>ConverterScanner</c> object. This
 /// uses an internal factory to instantiate and cache all of the
 /// converters created. This will ensure that there is reduced
 /// overhead for a serialization process using converters.
 /// </summary>
 public ConverterScanner()
 {
     this.factory = new ConverterFactory();
     this.builder = new ScannerBuilder();
 }
 public void TestFactory()
 {
     ConverterFactory factory = new ConverterFactory();
     Converter        a1      = factory.getInstance(A.class);
Example #4
0
 /// <summary>
 /// Constructor for the <c>RegistryBinder</c> object. This
 /// is used to create bindings between classes and the converters
 /// that should be used to serialize and deserialize the instances.
 /// All converters are instantiated once and cached for reuse.
 /// </summary>
 public RegistryBinder()
 {
     this.factory = new ConverterFactory();
     this.cache   = new ClassCache();
 }
 public void TestFactory() {
    ConverterFactory factory = new ConverterFactory();
    Converter a1 = factory.getInstance(A.class);
Example #6
0
 /// <summary>
 /// Constructor for the <c>ConverterScanner</c> object. This
 /// uses an internal factory to instantiate and cache all of the
 /// converters created. This will ensure that there is reduced
 /// overhead for a serialization process using converters.
 /// </summary>
 public ConverterScanner() {
    this.factory = new ConverterFactory();
    this.builder = new ScannerBuilder();
 }