当前位置: 首页>>代码示例>>C#>>正文


C# Objects.MutablePropertyValues类代码示例

本文整理汇总了C#中Spring.Objects.MutablePropertyValues的典型用法代码示例。如果您正苦于以下问题:C# MutablePropertyValues类的具体用法?C# MutablePropertyValues怎么用?C# MutablePropertyValues使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MutablePropertyValues类属于Spring.Objects命名空间,在下文中一共展示了MutablePropertyValues类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParseTestObjectDefinition

        private ObjectDefinitionHolder ParseTestObjectDefinition(XmlElement rootElement, ParserContext parserContext)
        {
            MutablePropertyValues properties = new MutablePropertyValues();
            
            XmlNodeList childNodes = rootElement.ChildNodes;

            //Get all properties (from non whitespace nodes)
            foreach (XmlNode childNode in childNodes)
            {                
                if (XmlNodeType.Whitespace != childNode.NodeType)
                {
                    properties.Add(new PropertyValue(childNode.LocalName, childNode.InnerText));
                }
            }
            IConfigurableObjectDefinition od = new RootObjectDefinition(typeof (TestObject), null, properties);
            od.IsSingleton = false;

            //HardCoded for now.
            string id = "testObject";
            //id = ObjectDefinitionReaderUtils.GenerateObjectName(od, reader.ObjectReader.Registry);

            return new ObjectDefinitionHolder(od, id);


        }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:25,代码来源:TestObjectConfigParser.cs

示例2: Instantiation

 public void Instantiation () {
     MutablePropertyValues root = new MutablePropertyValues ();
     root.Add (new PropertyValue ("Name", "Fiona Apple"));
     root.Add (new PropertyValue ("Age", 24));
     MutablePropertyValues props = new MutablePropertyValues (root);
     Assert.AreEqual (2, props.PropertyValues.Count);
 }
开发者ID:Binodesk,项目名称:spring-net,代码行数:7,代码来源:MutablePropertyValuesTests.cs

示例3: AddAllInNullMap

 public void AddAllInNullMap()
 {
     MutablePropertyValues props = new MutablePropertyValues ();
     props.Add (new PropertyValue ("Name", "Fiona Apple"));
     props.AddAll ((IDictionary) null);
     Assert.AreEqual (1, props.PropertyValues.Length);
 }
开发者ID:smnbss,项目名称:spring-net,代码行数:7,代码来源:MutablePropertyValuesTests.cs

示例4: InstantiationWithNulls

 public void InstantiationWithNulls () 
 {
     MutablePropertyValues props = new MutablePropertyValues ((IDictionary<string, object>) null);
     Assert.AreEqual (0, props.PropertyValues.Count);
     MutablePropertyValues props2 = new MutablePropertyValues ((IPropertyValues) null);
     Assert.AreEqual (0, props2.PropertyValues.Count);
 }
开发者ID:Binodesk,项目名称:spring-net,代码行数:7,代码来源:MutablePropertyValuesTests.cs

示例5: CreateJobInstance

 /// <summary> 
 /// Create the job instance, populating it with property values taken
 /// from the scheduler context, job data map and trigger data map.
 /// </summary>
 protected override object CreateJobInstance(TriggerFiredBundle bundle)
 {
     ObjectWrapper ow = new ObjectWrapper(bundle.JobDetail.JobType);
     if (IsEligibleForPropertyPopulation(ow.WrappedInstance))
     {
         MutablePropertyValues pvs = new MutablePropertyValues();
         if (schedulerContext != null)
         {
             pvs.AddAll(schedulerContext);
         }
         pvs.AddAll(bundle.JobDetail.JobDataMap);
         pvs.AddAll(bundle.Trigger.JobDataMap);
         if (ignoredUnknownProperties != null)
         {
             for (int i = 0; i < ignoredUnknownProperties.Length; i++)
             {
                 string propName = ignoredUnknownProperties[i];
                 if (pvs.Contains(propName))
                 {
                     pvs.Remove(propName);
                 }
             }
             ow.SetPropertyValues(pvs);
         }
         else
         {
             ow.SetPropertyValues(pvs, true);
         }
     }
     return ow.WrappedInstance;
 }
开发者ID:Binodesk,项目名称:spring-net,代码行数:35,代码来源:SpringObjectJobFactory.cs

示例6: AddAllInNullList

 public void AddAllInNullList()
 {
     MutablePropertyValues props = new MutablePropertyValues ();
     props.Add (new PropertyValue ("Name", "Fiona Apple"));
     props.Add (new PropertyValue ("Age", 24));
     props.AddAll ((IList) null);
     Assert.AreEqual (2, props.PropertyValues.Length);
 }
开发者ID:smnbss,项目名称:spring-net,代码行数:8,代码来源:MutablePropertyValuesTests.cs

示例7: AddAllInList

 public void AddAllInList()
 {
     MutablePropertyValues props = new MutablePropertyValues ();
     props.AddAll (new PropertyValue [] {
         new PropertyValue ("Name", "Fiona Apple"),
         new PropertyValue ("Age", 24)});
     Assert.AreEqual (2, props.PropertyValues.Length);
 }
开发者ID:smnbss,项目名称:spring-net,代码行数:8,代码来源:MutablePropertyValuesTests.cs

示例8: AddAllInMap

 public void AddAllInMap()
 {
     MutablePropertyValues props = new MutablePropertyValues ();
     IDictionary map = new Hashtable ();
     map.Add ("Name", "Fiona Apple");
     map.Add ("Age", 24);
     props.AddAll (map);
     Assert.AreEqual (2, props.PropertyValues.Length);
 }
开发者ID:smnbss,项目名称:spring-net,代码行数:9,代码来源:MutablePropertyValuesTests.cs

示例9: getMutablePropertyValues

      private MutablePropertyValues getMutablePropertyValues(TypeRegistration registrationEntry)
      {
         MutablePropertyValues properties = new MutablePropertyValues();
         foreach (InjectedProperty property in registrationEntry.InjectedProperties)
         {
            properties.Add(new PropertyValue(property.PropertyName,getInjectionParameterValue(property.PropertyValue)));
         }

         return properties;
      }
开发者ID:ericklombardo,项目名称:Nuaguil.Net,代码行数:10,代码来源:SpringContainerConfigurator.cs

示例10: Execute

		/// <summary> 
		/// This implementation applies the passed-in job data map as object property
		/// values, and delegates to <code>ExecuteInternal</code> afterwards.
		/// </summary>
		/// <seealso cref="ExecuteInternal" />
        public void Execute(IJobExecutionContext context)
		{
			try
			{
				ObjectWrapper bw = new ObjectWrapper(this);
				MutablePropertyValues pvs = new MutablePropertyValues();
				pvs.AddAll(context.Scheduler.Context);
				pvs.AddAll(context.MergedJobDataMap);
				bw.SetPropertyValues(pvs, true);
			}
			catch (SchedulerException ex)
			{
				throw new JobExecutionException(ex);
			}
			ExecuteInternal(context);
		}
开发者ID:fgq841103,项目名称:spring-net,代码行数:21,代码来源:QuartzJobObject.cs

示例11: PostProcessPropertyValues

        public override IPropertyValues PostProcessPropertyValues(IPropertyValues propertyValues, PropertyInfo[] propertyInfos, object objectInstance, string objectName)
        {
            MutablePropertyValues mpv = new MutablePropertyValues(propertyValues);

            IConfigurableObjectDefinition objectDefinition = (IConfigurableObjectDefinition)_objectFactory.GetObjectDefinition(objectName);
            DependencyCheckingMode checkMode = objectDefinition.DependencyCheck;
            PropertyInfo[] unresolvedProperties = AutowireUtils.GetUnsatisfiedDependencies(propertyInfos, propertyValues, checkMode);
            foreach(PropertyInfo propertyInfo in unresolvedProperties)
            {
                object value = ResolveDependency(objectName, objectDefinition, new ObjectWrapper(objectInstance), propertyInfo);
                if (value != null)
                {
                    mpv.Add(propertyInfo.Name, value);
                }
            }

            return base.PostProcessPropertyValues(mpv, propertyInfos, objectInstance, objectName);
        }
开发者ID:eeichinger,项目名称:pons,代码行数:18,代码来源:AbstractCustomDependencyResolverPostProcessor.cs

示例12: ChangesSince

        public void ChangesSince()
        {
            IDictionary map = new Hashtable ();
            PropertyValue propName = new PropertyValue ("Name", "Fiona Apple");
            map.Add (propName.Name, propName.Value);
            map.Add ("Age", 24);
            MutablePropertyValues props = new MutablePropertyValues (map);
            MutablePropertyValues newProps = new MutablePropertyValues (map);

            // change the name... this is the change we'll be looking for
            newProps.SetPropertyValueAt (new PropertyValue (propName.Name, "Naomi Woolf"), 0);
            IPropertyValues changes = newProps.ChangesSince (props);
            Assert.AreEqual (1, changes.PropertyValues.Length);
            // the name was changed, so its the name property that should be in the changed list
            Assert.IsTrue (changes.Contains ("name"));

            newProps.Add (new PropertyValue ("Commentator", "Naomi Woolf"));
            changes = newProps.ChangesSince (props);
            Assert.AreEqual (2, changes.PropertyValues.Length);
            // the Commentator was added, so its the Commentator property that should be in the changed list
            Assert.IsTrue (changes.Contains ("commentator"));
            // the name was changed, so its the name property that should be in the changed list
            Assert.IsTrue (changes.Contains ("name"));
        }
开发者ID:smnbss,项目名称:spring-net,代码行数:24,代码来源:MutablePropertyValuesTests.cs

示例13: ParseResourceLoader

        /// <summary>
        /// Configures the NVelocity resource loader definitions from the xml definition
        /// </summary>
        /// <param name="element">the root resource loader element</param>
        /// <param name="objectDefinitionProperties">the MutablePropertyValues used to configure this object</param>
        /// <param name="properties">the properties used to initialize the velocity engine</param>
        private void ParseResourceLoader(XmlElement element, MutablePropertyValues objectDefinitionProperties, IDictionary<string, object> properties) {
            string caching = GetAttributeValue(element, TemplateDefinitionConstants.AttributeTemplateCaching);
            string defaultCacheSize = GetAttributeValue(element, TemplateDefinitionConstants.AttributeDefaultCacheSize);
            string modificationCheckInterval = GetAttributeValue(element, TemplateDefinitionConstants.AttributeModificationCheckInterval);

            if (!string.IsNullOrEmpty(defaultCacheSize)) {
                properties.Add(RuntimeConstants.RESOURCE_MANAGER_DEFAULTCACHE_SIZE, defaultCacheSize);
            }

            XmlNodeList loaderElements = element.ChildNodes;
            switch (loaderElements[0].LocalName) {
                case VelocityConstants.File:
                    AppendFileLoaderProperties(loaderElements, properties);
                    AppendResourceLoaderGlobalProperties(properties, VelocityConstants.File, caching,
                                                         modificationCheckInterval);
                    break;
                case VelocityConstants.Assembly:
                    AppendAssemblyLoaderProperties(loaderElements, properties);
                    AppendResourceLoaderGlobalProperties(properties, VelocityConstants.Assembly, caching, null);
                    break;
                case TemplateDefinitionConstants.Spring:
                    AppendResourceLoaderPaths(loaderElements, objectDefinitionProperties);
                    AppendResourceLoaderGlobalProperties(properties, TemplateDefinitionConstants.Spring, caching, null);
                    break;
                case TemplateDefinitionConstants.Custom:
                    XmlElement firstElement = (XmlElement)loaderElements.Item(0);
                    AppendCustomLoaderProperties(firstElement, properties);
                    AppendResourceLoaderGlobalProperties(properties, firstElement.LocalName, caching, modificationCheckInterval);
                    break;
                default:
                    throw new ArgumentException(string.Format("undefined element for resource loadre type: {0}", element.LocalName));
            }
        }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:39,代码来源:TemplateNamespaceParser.cs

示例14: ParseChildDefinitions

        /// <summary>
        /// Parses child element definitions for the NVelocity engine. Typically resource loaders and locally defined properties are parsed here
        /// </summary>
        /// <param name="childElements">the XmlNodeList representing the child configuration of the root NVelocity engine element</param>
        /// <param name="parserContext">the parser context</param>
        /// <param name="objectDefinitionProperties">the MutablePropertyValues used to configure this object</param>
        private void ParseChildDefinitions(XmlNodeList childElements, ParserContext parserContext, MutablePropertyValues objectDefinitionProperties) {
            IDictionary<string, object> properties = new Dictionary<string, object>();

            foreach (XmlElement element in childElements) {
                switch (element.LocalName) {
                    case TemplateDefinitionConstants.ElementResourceLoader:
                        ParseResourceLoader(element, objectDefinitionProperties, properties);
                        break;
                    case TemplateDefinitionConstants.ElementNVelocityProperties:
                        ParseNVelocityProperties(element, parserContext, properties);
                        break;
                }
            }

            if (properties.Count > 0) {
                objectDefinitionProperties.Add(TemplateDefinitionConstants.PropertyVelocityProperties, properties);
            }
        }
开发者ID:ouyangyl,项目名称:MySpringNet,代码行数:24,代码来源:TemplateNamespaceParser.cs

示例15: ParseErrorMessageAction

        /// <summary>
        /// Creates an error message action based on the specified message element.
        /// </summary>
        /// <param name="message">The message element.</param>
        /// <param name="parserContext">The parser helper.</param>
        /// <returns>The error message action definition.</returns>
        private static IObjectDefinition ParseErrorMessageAction(XmlElement message, ParserContext parserContext)
        {
            string messageId = GetAttributeValue(message, MessageConstants.IdAttribute);
            string[] providers = GetAttributeValue(message, MessageConstants.ProvidersAttribute).Split(',');
            ArrayList parameters = new ArrayList();

            foreach (XmlElement param in message.ChildNodes)
            {
                IExpression paramExpression = Expression.Parse(GetAttributeValue(param, MessageConstants.ParameterValueAttribute));
                parameters.Add(paramExpression);
            }

            string typeName = "Spring.Validation.Actions.ErrorMessageAction, Spring.Core";
            ConstructorArgumentValues ctorArgs = new ConstructorArgumentValues();
            ctorArgs.AddGenericArgumentValue(messageId);
            ctorArgs.AddGenericArgumentValue(providers);

            string when = GetAttributeValue(message, ValidatorDefinitionConstants.WhenAttribute);
            MutablePropertyValues properties = new MutablePropertyValues();
            if (StringUtils.HasText(when))
            {
                properties.Add("When", when);
            }
            if (parameters.Count > 0)
            {
                properties.Add("Parameters", parameters.ToArray(typeof(IExpression)));
            }

            IConfigurableObjectDefinition action =
                parserContext.ReaderContext.ObjectDefinitionFactory.CreateObjectDefinition(typeName, null, parserContext.ReaderContext.Reader.Domain);
            action.ConstructorArgumentValues = ctorArgs;
            action.PropertyValues = properties;

            return action;
        }
开发者ID:likesea,项目名称:spring.net,代码行数:41,代码来源:ValidationNamespaceParser.cs


注:本文中的Spring.Objects.MutablePropertyValues类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。