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.
コード例 #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();
 }
コード例 #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();
 }
コード例 #3
0
 public void TestFactory()
 {
     ConverterFactory factory = new ConverterFactory();
     Converter        a1      = factory.getInstance(A.class);
コード例 #4
0
ファイル: RegistryBinder.cs プロジェクト: restlet/simplexml
 /// <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();
 }
コード例 #5
0
 public void TestFactory() {
    ConverterFactory factory = new ConverterFactory();
    Converter a1 = factory.getInstance(A.class);
コード例 #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();
 }