GetValue() public method

This is used to get the value converter for the entry. This knows whether the value type is a primitive or composite object and will provide the appropriate converter implementation. This allows the root composite map converter to concern itself with only the details of the surrounding entry object.
public GetValue ( Context context ) : Converter
context Context /// this is the root context for the serialization ///
return Converter
Ejemplo n.º 1
0
        /// <summary>
        /// This method is used to read the value object from the node. The
        /// value read from the node is resolved using the template filter.
        /// If the value data can not be found according to the annotation
        /// attributes then null is assumed and the node is valid.
        /// </summary>
        /// <param name="node">
        /// this is the node to read the value object from
        /// </param>
        /// <returns>
        /// this returns true if this represents a valid value
        /// </returns>
        public bool Validate(InputNode node)
        {
            Class  expect = type.Type;
            String name   = entry.GetValue();

            if (name == null)
            {
                name = context.GetName(expect);
            }
            return(Validate(node, name));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This method is used to read the value value from the node. The
        /// value read from the node is resolved using the template filter.
        /// If the value value can not be found according to the annotation
        /// attributes then an exception is thrown.
        /// </summary>
        /// <param name="node">
        /// this is the node to read the value object from
        /// </param>
        /// <returns>
        /// this returns the value deserialized from the node
        /// </returns>
        public Object Read(InputNode node)
        {
            Class  expect = type.Type;
            String name   = entry.GetValue();

            if (name == null)
            {
                name = context.GetName(expect);
            }
            if (entry.IsInline())
            {
                return(root.Read(node));
            }
            return(Read(node, name));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Constructor for the <c>CompositeMap</c> object. This will
 /// create a converter that is capable of writing map objects to
 /// and from XML. The resulting XML is configured by an annotation
 /// such that key values can attributes and values can be inline.
 /// </summary>
 /// <param name="context">
 /// this is the root context for the serialization
 /// </param>
 /// <param name="entry">
 /// this provides configuration for the resulting XML
 /// </param>
 /// <param name="type">
 /// this is the map type that is to be converted
 /// </param>
 public CompositeInlineMap(Context context, Entry entry, Type type)
 {
     this.factory = new MapFactory(context, type);
     this.value   = entry.GetValue(context);
     this.key     = entry.GetKey(context);
     this.style   = context.getStyle();
     this.entry   = entry;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Constructor for the <c>CompositeMap</c> object. This will
 /// create a converter that is capable of writing map objects to
 /// and from XML. The resulting XML is configured by an annotation
 /// such that key values can attributes and values can be inline.
 /// </summary>
 /// <param name="context">
 /// this is the root context for the serialization
 /// </param>
 /// <param name="entry">
 /// this provides configuration for the resulting XML
 /// </param>
 /// <param name="type">
 /// this is the map type that is to be converted
 /// </param>
 public CompositeMap(Context context, Entry entry, Type type) {
    this.factory = new MapFactory(context, type);
    this.value = entry.GetValue(context);
    this.key = entry.GetKey(context);
    this.style = context.getStyle();
    this.entry = entry;
 }