private void ParseQualifierProperties(QualifierAttribute attr, AutowireCandidateQualifier qualifier)
 {
     foreach (var property in attr.GetType().GetProperties())
     {
         if (!property.Name.Equals("TypeId") && !property.Name.Equals("Value"))
         {
             object value = property.GetValue(attr, null);
             if (value != null)
             {
                 var attribute = new ObjectMetadataAttribute(property.Name, value);
                 qualifier.AddMetadataAttribute(attribute);
             }
         }
     }
 }
        /// <summary>
        /// Parse a qualifier element.
        /// </summary>
        public void ParseQualifierElement(string name, XmlElement element, ParserContext parserContext, AbstractObjectDefinition od)
        {
            string typeName = GetAttributeValue(element, ObjectDefinitionConstants.TypeAttribute);
            string value = GetAttributeValue(element, ObjectDefinitionConstants.ValueAttribute);

            if (string.IsNullOrEmpty(typeName))
            {
                throw new ObjectDefinitionStoreException(
                                    parserContext.ReaderContext.Resource, name,
                                    "Tag 'qualifier' must have a 'type' attribute");
            }
            
            var qualifier = new AutowireCandidateQualifier(typeName);
            qualifier.Source = element;

            if (!string.IsNullOrEmpty(value))
                qualifier.SetAttribute(AutowireCandidateQualifier.VALUE_KEY, value);

            foreach (XmlNode node in this.SelectNodes(element, ObjectDefinitionConstants.AttributeElement))
            {
                var attributeEle = node as XmlElement;
                string attributeKey = GetAttributeValue(attributeEle, ObjectDefinitionConstants.KeyAttribute);
                string attributeValue = GetAttributeValue(attributeEle, ObjectDefinitionConstants.ValueAttribute);

                if (!string.IsNullOrEmpty(attributeKey) && !string.IsNullOrEmpty(attributeValue))
                {
                    var attribute = new ObjectMetadataAttribute(attributeKey, attributeValue);
                    attribute.Source = attributeEle;
                    qualifier.AddMetadataAttribute(attribute);
                }
                else
                {
                    throw new ObjectDefinitionStoreException(
                                        parserContext.ReaderContext.Resource, name,
                                        "Qualifier 'attribute' tag must have a 'key' and 'value'");
                }
            }
            od.AddQualifier(qualifier);
        }
        /// <summary>
        /// Parse the meta upplied meta attributes if the given object element
        /// </summary>
        protected void ParseMetaElements(XmlElement element, ObjectMetadataAttributeAccessor attributeAccessor)
        {
            foreach (XmlNode node in this.SelectNodes(element, ObjectDefinitionConstants.MetaElement))
            {
                string key = GetAttributeValue((XmlElement)node, ObjectDefinitionConstants.KeyAttribute);
                string value = GetAttributeValue((XmlElement)node, ObjectDefinitionConstants.ValueAttribute);

                ObjectMetadataAttribute attribute = new ObjectMetadataAttribute(key, value);
                attribute.Source = (XmlElement)node;
                attributeAccessor.AddMetadataAttribute(attribute);                                
            }
        }