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


Java MutablePropertyValues.addPropertyValues方法代码示例

本文整理汇总了Java中org.springframework.beans.MutablePropertyValues.addPropertyValues方法的典型用法代码示例。如果您正苦于以下问题:Java MutablePropertyValues.addPropertyValues方法的具体用法?Java MutablePropertyValues.addPropertyValues怎么用?Java MutablePropertyValues.addPropertyValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.beans.MutablePropertyValues的用法示例。


在下文中一共展示了MutablePropertyValues.addPropertyValues方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initJob

import org.springframework.beans.MutablePropertyValues; //导入方法依赖的package包/类
protected void initJob(TriggerFiredBundle bundle, Object job) {
	// The following code is copied from SpringBeanJobFactory in spring-context-support-4.2.5.RELEASE
	BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(job);
	if (isEligibleForPropertyPopulation(bw.getWrappedInstance())) {
		MutablePropertyValues pvs = new MutablePropertyValues();
		if (schedulerContext != null) {
			pvs.addPropertyValues(this.schedulerContext);
		}
		pvs.addPropertyValues(bundle.getJobDetail().getJobDataMap());
		pvs.addPropertyValues(bundle.getTrigger().getJobDataMap());
		if (this.ignoredUnknownProperties != null) {
			for (String propName : this.ignoredUnknownProperties) {
				if (pvs.contains(propName) && !bw.isWritableProperty(propName)) {
					pvs.removePropertyValue(propName);
				}
			}
			bw.setPropertyValues(pvs);
		}
		else {
			bw.setPropertyValues(pvs, true);
		}
	}
}
 
开发者ID:xtianus,项目名称:yadaframework,代码行数:24,代码来源:YadaQuartzJobFactory.java

示例2: createJobInstance

import org.springframework.beans.MutablePropertyValues; //导入方法依赖的package包/类
/**
 * Create the job instance, populating it with property values taken
 * from the scheduler context, job data map and trigger data map.
 */
@Override
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
	Object job = super.createJobInstance(bundle);
	BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(job);
	if (isEligibleForPropertyPopulation(bw.getWrappedInstance())) {
		MutablePropertyValues pvs = new MutablePropertyValues();
		if (this.schedulerContext != null) {
			pvs.addPropertyValues(this.schedulerContext);
		}
		pvs.addPropertyValues(bundle.getJobDetail().getJobDataMap());
		pvs.addPropertyValues(bundle.getTrigger().getJobDataMap());
		if (this.ignoredUnknownProperties != null) {
			for (String propName : this.ignoredUnknownProperties) {
				if (pvs.contains(propName) && !bw.isWritableProperty(propName)) {
					pvs.removePropertyValue(propName);
				}
			}
			bw.setPropertyValues(pvs);
		}
		else {
			bw.setPropertyValues(pvs, true);
		}
	}
	return job;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:30,代码来源:SpringBeanJobFactory.java

示例3: execute

import org.springframework.beans.MutablePropertyValues; //导入方法依赖的package包/类
/**
 * This implementation applies the passed-in job data map as bean property
 * values, and delegates to {@code executeInternal} afterwards.
 * @see #executeInternal
 */
@Override
public final void execute(JobExecutionContext context) throws JobExecutionException {
	try {
		// Reflectively adapting to differences between Quartz 1.x and Quartz 2.0...
		Scheduler scheduler = (Scheduler) ReflectionUtils.invokeMethod(getSchedulerMethod, context);
		Map<?, ?> mergedJobDataMap = (Map<?, ?>) ReflectionUtils.invokeMethod(getMergedJobDataMapMethod, context);

		BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(this);
		MutablePropertyValues pvs = new MutablePropertyValues();
		pvs.addPropertyValues(scheduler.getContext());
		pvs.addPropertyValues(mergedJobDataMap);
		bw.setPropertyValues(pvs, true);
	}
	catch (SchedulerException ex) {
		throw new JobExecutionException(ex);
	}
	executeInternal(context);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:QuartzJobBean.java

示例4: createJobInstance

import org.springframework.beans.MutablePropertyValues; //导入方法依赖的package包/类
/**
 * Create the job instance, populating it with property values taken
 * from the scheduler context, job data map and trigger data map.
 */
@Override
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
	Object job = super.createJobInstance(bundle);
	BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(job);
	if (isEligibleForPropertyPopulation(bw.getWrappedInstance())) {
		MutablePropertyValues pvs = new MutablePropertyValues();
		if (this.schedulerContext != null) {
			pvs.addPropertyValues(this.schedulerContext);
		}
		pvs.addPropertyValues(getJobDetailDataMap(bundle));
		pvs.addPropertyValues(getTriggerDataMap(bundle));
		if (this.ignoredUnknownProperties != null) {
			for (String propName : this.ignoredUnknownProperties) {
				if (pvs.contains(propName) && !bw.isWritableProperty(propName)) {
					pvs.removePropertyValue(propName);
				}
			}
			bw.setPropertyValues(pvs);
		}
		else {
			bw.setPropertyValues(pvs, true);
		}
	}
	return job;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:SpringBeanJobFactory.java

示例5: execute

import org.springframework.beans.MutablePropertyValues; //导入方法依赖的package包/类
/**
 * This implementation applies the passed-in job data map as bean property
 * values, and delegates to {@code executeInternal} afterwards.
 * @see #executeInternal
 */
@Override
public final void execute(JobExecutionContext context) throws JobExecutionException {
	try {
		BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(this);
		MutablePropertyValues pvs = new MutablePropertyValues();
		pvs.addPropertyValues(context.getScheduler().getContext());
		pvs.addPropertyValues(context.getMergedJobDataMap());
		bw.setPropertyValues(pvs, true);
	}
	catch (SchedulerException ex) {
		throw new JobExecutionException(ex);
	}
	executeInternal(context);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:20,代码来源:QuartzJobBean.java

示例6: bindXaProperties

import org.springframework.beans.MutablePropertyValues; //导入方法依赖的package包/类
private void bindXaProperties(XADataSource target, DataSourceProperties properties) {
	MutablePropertyValues values = new MutablePropertyValues();
	values.add("user", this.properties.determineUsername());
	values.add("password", this.properties.determinePassword());
	values.add("url", this.properties.determineUrl());
	values.addPropertyValues(properties.getXa().getProperties());
	new RelaxedDataBinder(target).withAlias("user", "username").bind(values);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:XADataSourceAutoConfiguration.java

示例7: deserialize

import org.springframework.beans.MutablePropertyValues; //导入方法依赖的package包/类
/**
 * Deserializes JSON content into Map<String, String> format and then uses a
 * Spring {@link DataBinder} to bind the data from JSON message to JavaBean
 * objects.
 * <p/>
 * It is a workaround for issue
 * https://jira.springsource.org/browse/SPR-6731 that should be removed from
 * next gvNIX releases when that issue will be resolved.
 * 
 * @param parser Parsed used for reading JSON content
 * @param ctxt Context that can be used to access information about this
 *        deserialization activity.
 * 
 * @return Deserializer value
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Object deserialize(JsonParser parser, DeserializationContext ctxt)
        throws IOException, JsonProcessingException {
    JsonToken t = parser.getCurrentToken();
    MutablePropertyValues propertyValues = new MutablePropertyValues();

    // Get target from DataBinder from local thread. If its a bean
    // collection
    // prepares array index for property names. Otherwise continue.
    DataBinder binder = (DataBinder) ThreadLocalUtil
            .getThreadVariable(BindingResult.MODEL_KEY_PREFIX
                    .concat("JSON_DataBinder"));
    Object target = binder.getTarget();

    // For DstaBinderList instances, contentTarget contains the final bean
    // for binding. DataBinderList is just a simple wrapper to deserialize
    // bean wrapper using DataBinder
    Object contentTarget = null;

    if (t == JsonToken.START_OBJECT) {
        String prefix = null;
        if (target instanceof DataBinderList) {
            prefix = binder.getObjectName().concat("[")
                    .concat(Integer.toString(((Collection) target).size()))
                    .concat("].");

            // BeanWrapperImpl cannot create new instances if generics
            // don't specify content class, so do it by hand
            contentTarget = BeanUtils
                    .instantiateClass(((DataBinderList) target)
                            .getContentClass());
            ((Collection) target).add(contentTarget);
        }
        else if (target instanceof Map) {
            // TODO
            LOGGER.warn("Map deserialization not implemented yet!");
        }
        Map<String, String> obj = readObject(parser, ctxt, prefix);
        propertyValues.addPropertyValues(obj);
    }
    else {
        LOGGER.warn("Deserialization for non-object not implemented yet!");
        return null; // TODO?
    }

    // bind to the target object
    binder.bind(propertyValues);

    // Note there is no need to validate the target object because
    // RequestResponseBodyMethodProcessor.resolveArgument() does it on top
    // of including BindingResult as Model attribute

    // For DAtaBinderList the contentTarget contains the final bean to
    // make the binding, so we must return it
    if (contentTarget != null) {
        return contentTarget;
    }
    return binder.getTarget();
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:76,代码来源:DataBinderDeserializer.java


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