IsAttribute() public method

Represents whether the key value is to be an attribute or an element. This allows the key to be embedded within the entry XML element allowing for a more compact representation. Only primitive key objects can be represented as an attribute. For example a java.util.Date or a string could be represented as an attribute key for the generated XML.
public IsAttribute ( ) : bool
return bool
Ejemplo n.º 1
0
        /// <summary>
        /// This method is used to read the key value from the node. The
        /// value read from the node is resolved using the template filter.
        /// If the key 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 key value from
        /// </param>
        /// <returns>
        /// this returns the value deserialized from the node
        /// </returns>
        public Object Read(InputNode node)
        {
            Class  expect = type.Type;
            String name   = entry.Key;

            if (name == null)
            {
                name = context.GetName(expect);
            }
            if (!entry.IsAttribute())
            {
                return(ReadElement(node, name));
            }
            return(ReadAttribute(node, name));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This method is used to read the key value from the node. The
        /// value read from the node is resolved using the template filter.
        /// If the key value can not be found according to the annotation
        /// attributes then null is assumed and returned.
        /// </summary>
        /// <param name="node">
        /// this is the node to read the key value from
        /// </param>
        /// <returns>
        /// this returns the value deserialized from the node
        /// </returns>
        public Object Read(InputNode node)
        {
            Position line   = node.getPosition();
            Class    expect = type.Type;
            String   name   = entry.Key;

            if (name == null)
            {
                name = context.GetName(expect);
            }
            if (entry.IsAttribute())
            {
                throw new ElementException("Can not have %s as an attribute at %s", expect, line);
            }
            return(Read(node, name));
        }