The Primitive object is used to provide serialization for primitive objects. This can serialize and deserialize any primitive object and enumerations. Primitive values are converted to text using the String.valueOf method. Enumerated types are converted using the Enum.valueOf method.

Text within attributes and elements can contain template variables similar to those found in Apache Ant. This allows values such as system properties, environment variables, and user specified mappings to be inserted into the text in place of the template reference variables. <example attribute="${value}> <text>Text with a ${variable}</text> </example> In the above XML element the template variable references will be checked against the Filter object used by the context serialization object. If they corrospond to a filtered value then they are replaced, if not the text remains unchanged.

Inheritance: Converter
Exemplo n.º 1
0
 /// <summary>
 /// Constructor for the <c>PrimitiveList</c> object. This is
 /// given the list type and entry type to be used. The list type is
 /// the <c>Collection</c> implementation that deserialized
 /// entry objects are inserted into.
 /// </summary>
 /// <param name="context">
 /// this is the context object used for serialization
 /// </param>
 /// <param name="type">
 /// this is the collection type for the list used
 /// </param>
 /// <param name="entry">
 /// the primitive type to be stored within the list
 /// </param>
 /// <param name="parent">
 /// this is the name to wrap the list element with
 /// </param>
 public PrimitiveList(Context context, Type type, Type entry, String parent) {
    this.factory = new CollectionFactory(context, type);
    this.root = new Primitive(context, entry);
    this.parent = parent;
    this.entry = entry;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor for the <c>Composite</c> object. This creates
 /// a converter object capable of serializing and deserializing root
 /// objects labeled with XML annotations. The XML schema class must
 /// be given to the instance in order to perform deserialization.
 /// </summary>
 /// <param name="context">
 /// the source object used to perform serialization
 /// </param>
 /// <param name="type">
 /// this is the XML schema type to use for this
 /// </param>
 public Composite(Context context, Type type) {
    this.factory = new ObjectFactory(context, type);
    this.primitive = new Primitive(context, type);
    this.criteria = new Collector(context);
    this.revision = new Revision();
    this.context = context;
    this.type = type;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Constructor for the <c>PrimitiveKey</c> object. This is
 /// used to create the key object which converts the map key to an
 /// instance of the key type. This can also resolve references.
 /// </summary>
 /// <param name="context">
 /// this is the context object used for serialization
 /// </param>
 /// <param name="entry">
 /// this is the entry object that describes entries
 /// </param>
 /// <param name="type">
 /// this is the type that this converter deals with
 /// </param>
 public PrimitiveKey(Context context, Entry entry, Type type) {
    this.factory = new PrimitiveFactory(context, type);
    this.root = new Primitive(context, type);
    this.style = context.Style;
    this.context = context;
    this.entry = entry;
    this.type = type;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Constructor for the <c>PrimitiveArray</c> object. This is
 /// given the array type for the contact that is to be converted. An
 /// array of the specified type is used to hold the deserialized
 /// elements and will be the same length as the number of elements.
 /// </summary>
 /// <param name="context">
 /// this is the context object used for serialization
 /// </param>
 /// <param name="type">
 /// this is the actual field type from the schema
 /// </param>
 /// <param name="entry">
 /// the entry type to be stored within the array
 /// </param>
 /// <param name="parent">
 /// this is the name to wrap the array element with
 /// </param>
 public PrimitiveArray(Context context, Type type, Type entry, String parent) {
    this.factory = new ArrayFactory(context, type);
    this.root = new Primitive(context, entry);
    this.parent = parent;
    this.entry = entry;
 }