The ConverterScanner is used to create a converter given a method or field representation. Creation of the converter is done using the Convert annotation, which may be used to annotate a field, method or class. This describes the implementation to use for object serialization. To account for polymorphism the type scanned for annotations can be overridden from type provided in the Type object. This ensures that if a collection of objects are serialized the correct implementation will be used for each type or subtype.
Ejemplo n.º 1
0
 /// <summary>
 /// Constructor for the <c>AnnotationStrategy</c> object.
 /// This creates a strategy that intercepts serialization on any
 /// annotated method or field. If no annotation exists then this
 /// will delegate to the <c>Strategy</c> provided.
 /// </summary>
 /// <param name="strategy">
 /// the internal strategy to delegate to
 /// </param>
 public AnnotationStrategy(Strategy strategy) {
    this.scanner = new ConverterScanner();
    this.strategy = strategy;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructor for the <c>AnnotationStrategy</c> object.
 /// This creates a strategy that intercepts serialization on any
 /// annotated method or field. If no annotation exists then this
 /// will delegate to the <c>Strategy</c> provided.
 /// </summary>
 /// <param name="strategy">
 /// the internal strategy to delegate to
 /// </param>
 public AnnotationStrategy(Strategy strategy)
 {
     this.scanner  = new ConverterScanner();
     this.strategy = strategy;
 }