The Support object is used to provide support to the serialization engine for processing and transforming strings. This contains a Transformer which will create objects from strings and will also reverse this process converting an object to a string. This is used in the conversion of primitive types.
Inheritance: Filter
Ejemplo n.º 1
0
 /// <summary>
 /// Constructor for the <c>Source</c> object. This is used to
 /// maintain a context during the serialization process. It holds
 /// the <c>Strategy</c> and <c>Context</c> used in the
 /// serialization process. The same source instance is used for
 /// each XML element evaluated in a the serialization process.
 /// </summary>
 /// <param name="strategy">
 /// this is used to resolve the classes used
 /// </param>
 /// <param name="support">
 /// this is the context used to process strings
 /// </param>
 /// <param name="style">
 /// this is the style used for the serialization
 /// </param>
 public Source(Strategy strategy, Support support, Style style) {
    this(strategy, support, style, true);
 }
Ejemplo n.º 2
0
 public void TestExample() {
    Support context = new Support();
    Strategy strategy = new TreeStrategy();
    Style style = new DefaultStyle();
    Source source = new Source(strategy, context, style);
    Scanner scanner = new Scanner(Example.class);
Ejemplo n.º 3
0
 /// <summary>
 /// Constructor for the <c>Source</c> object. This is used to
 /// maintain a context during the serialization process. It holds
 /// the <c>Strategy</c> and <c>Context</c> used in the
 /// serialization process. The same source instance is used for
 /// each XML element evaluated in a the serialization process.
 /// </summary>
 /// <param name="strategy">
 /// this is used to resolve the classes used
 /// </param>
 /// <param name="support">
 /// this is the context used to process strings
 /// </param>
 /// <param name="style">
 /// this is the style used for the serialization
 /// </param>
 /// <param name="strict">
 /// this determines whether to read in strict mode
 /// </param>
 public Source(Strategy strategy, Support support, Style style, bool strict) {
    this.filter = new TemplateFilter(this, support);
    this.engine = new TemplateEngine(filter);
    this.session = new Session();
    this.strategy = strategy;
    this.support = support;
    this.strict = strict;
    this.style = style;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Constructor for the <c>Factory</c> object. This is given
 /// the class type for the field that this factory will determine
 /// the actual type for. The actual type must be assignable to the
 /// field type to insure that any instance can be set.
 /// </summary>
 /// <param name="context">
 /// the contextual object used by the persister
 /// </param>
 /// <param name="type">
 /// this is the property representing the field
 /// </param>
 protected Factory(Context context, Type type)
 {
     this.support = context.Support;
     this.context = context;
     this.type    = type;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Constructor for the <c>Persister</c> object. This is used
 /// to create a serializer object that will use the provided matcher
 /// for customizable transformations. The <c>Matcher</c> will
 /// enable the persister to determine the correct way to transform
 /// the types that are not annotated and considered primitives.
 /// <p>
 /// This persister will use the provided <c>Strategy</c> to
 /// intercept the XML elements in order to read and write persistent
 /// data, such as the class name or version of the document.
 /// </summary>
 /// <param name="strategy">
 /// this is the strategy used to resolve classes
 /// </param>
 /// <param name="matcher">
 /// this is used to customize the transformations
 /// </param>
 /// <param name="filter">
 /// the filter used to replace template variables
 /// </param>
 public Persister(Strategy strategy, Filter filter, Matcher matcher, Format format) {
    this.support = new Support(filter, matcher);
    this.style = format.Style;
    this.strategy = strategy;
    this.format = format;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Constructor for the <c>Source</c> object. This is used to
 /// maintain a context during the serialization process. It holds
 /// the <c>Strategy</c> and <c>Context</c> used in the
 /// serialization process. The same source instance is used for
 /// each XML element evaluated in a the serialization process.
 /// </summary>
 /// <param name="strategy">
 /// this is used to resolve the classes used
 /// </param>
 /// <param name="support">
 /// this is the context used to process strings
 /// </param>
 /// <param name="style">
 /// this is the style used for the serialization
 /// </param>
 public Source(Strategy strategy, Support support, Style style)
 {
     this(strategy, support, style, true);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Constructor for the <c>Factory</c> object. This is given
 /// the class type for the field that this factory will determine
 /// the actual type for. The actual type must be assignable to the
 /// field type to insure that any instance can be set.
 /// </summary>
 /// <param name="context">
 /// the contextual object used by the persister
 /// </param>
 /// <param name="type">
 /// this is the property representing the field
 /// </param>
 protected Factory(Context context, Type type) {
    this.support = context.Support;
    this.context = context;
    this.type = type;
 }