本文整理汇总了Java中org.springframework.beans.MutablePropertyValues.contains方法的典型用法代码示例。如果您正苦于以下问题:Java MutablePropertyValues.contains方法的具体用法?Java MutablePropertyValues.contains怎么用?Java MutablePropertyValues.contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.beans.MutablePropertyValues
的用法示例。
在下文中一共展示了MutablePropertyValues.contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
示例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;
}
示例3: 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;
}
示例4: checkFieldDefaults
import org.springframework.beans.MutablePropertyValues; //导入方法依赖的package包/类
/**
* Check the given property values for field defaults,
* i.e. for fields that start with the field default prefix.
* <p>The existence of a field defaults indicates that the specified
* value should be used if the field is otherwise not present.
* @param mpvs the property values to be bound (can be modified)
* @see #getFieldDefaultPrefix
*/
protected void checkFieldDefaults(MutablePropertyValues mpvs) {
if (getFieldDefaultPrefix() != null) {
String fieldDefaultPrefix = getFieldDefaultPrefix();
PropertyValue[] pvArray = mpvs.getPropertyValues();
for (PropertyValue pv : pvArray) {
if (pv.getName().startsWith(fieldDefaultPrefix)) {
String field = pv.getName().substring(fieldDefaultPrefix.length());
if (getPropertyAccessor().isWritableProperty(field) && !mpvs.contains(field)) {
mpvs.add(field, pv.getValue());
}
mpvs.removePropertyValue(pv);
}
}
}
}
示例5: checkFieldMarkers
import org.springframework.beans.MutablePropertyValues; //导入方法依赖的package包/类
/**
* Check the given property values for field markers,
* i.e. for fields that start with the field marker prefix.
* <p>The existence of a field marker indicates that the specified
* field existed in the form. If the property values do not contain
* a corresponding field value, the field will be considered as empty
* and will be reset appropriately.
* @param mpvs the property values to be bound (can be modified)
* @see #getFieldMarkerPrefix
* @see #getEmptyValue(String, Class)
*/
protected void checkFieldMarkers(MutablePropertyValues mpvs) {
if (getFieldMarkerPrefix() != null) {
String fieldMarkerPrefix = getFieldMarkerPrefix();
PropertyValue[] pvArray = mpvs.getPropertyValues();
for (PropertyValue pv : pvArray) {
if (pv.getName().startsWith(fieldMarkerPrefix)) {
String field = pv.getName().substring(fieldMarkerPrefix.length());
if (getPropertyAccessor().isWritableProperty(field) && !mpvs.contains(field)) {
Class<?> fieldType = getPropertyAccessor().getPropertyType(field);
mpvs.add(field, getEmptyValue(field, fieldType));
}
mpvs.removePropertyValue(pv);
}
}
}
}
示例6: decorate
import org.springframework.beans.MutablePropertyValues; //导入方法依赖的package包/类
@Override
public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) {
if (node instanceof Attr) {
Attr attr = (Attr) node;
String propertyName = parserContext.getDelegate().getLocalName(attr);
String propertyValue = attr.getValue();
MutablePropertyValues pvs = definition.getBeanDefinition().getPropertyValues();
if (pvs.contains(propertyName)) {
parserContext.getReaderContext().error("Property '" + propertyName + "' is already defined using " +
"both <property> and inline syntax. Only one approach may be used per property.", attr);
}
if (propertyName.endsWith(REF_SUFFIX)) {
propertyName = propertyName.substring(0, propertyName.length() - REF_SUFFIX.length());
pvs.add(Conventions.attributeNameToPropertyName(propertyName), new RuntimeBeanReference(propertyValue));
}
else {
pvs.add(Conventions.attributeNameToPropertyName(propertyName), propertyValue);
}
}
return definition;
}
示例7: postProcessBeanFactory
import org.springframework.beans.MutablePropertyValues; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public void postProcessBeanFactory(
ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
String[] igniteConfigNames = configurableListableBeanFactory.getBeanNamesForType(IgniteConfiguration.class);
if (igniteConfigNames.length != 1) {
throw new IllegalArgumentException("Spring config must contain exactly one ignite configuration!");
}
String[] activeStoreConfigNames = configurableListableBeanFactory.getBeanNamesForType(BaseActiveStoreConfiguration.class);
if (activeStoreConfigNames.length != 1) {
throw new IllegalArgumentException("Spring config must contain exactly one active store configuration!");
}
BeanDefinition igniteConfigDef = configurableListableBeanFactory.getBeanDefinition(igniteConfigNames[0]);
MutablePropertyValues propertyValues = igniteConfigDef.getPropertyValues();
if (!propertyValues.contains(USER_ATTRS_PROP_NAME)) {
propertyValues.add(USER_ATTRS_PROP_NAME, new ManagedMap());
}
PropertyValue propertyValue = propertyValues.getPropertyValue(USER_ATTRS_PROP_NAME);
Map userAttrs = (Map)propertyValue.getValue();
TypedStringValue key = new TypedStringValue(CONFIG_USER_ATTR);
RuntimeBeanReference value = new RuntimeBeanReference(beanName);
userAttrs.put(key, value);
}
示例8: addBindValues
import org.springframework.beans.MutablePropertyValues; //导入方法依赖的package包/类
/**
* Merge URI variables into the property values to use for data binding.
*/
@Override
@SuppressWarnings("unchecked")
protected void addBindValues(MutablePropertyValues mpvs, ServletRequest request) {
String attr = HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE;
Map<String, String> uriVars = (Map<String, String>) request.getAttribute(attr);
if (uriVars != null) {
for (Entry<String, String> entry : uriVars.entrySet()) {
if (mpvs.contains(entry.getKey())) {
logger.warn("Skipping URI variable '" + entry.getKey()
+ "' since the request contains a bind value with the same name.");
}
else {
mpvs.addPropertyValue(entry.getKey(), entry.getValue());
}
}
}
}
示例9: SimpleReferenceListMetadata
import org.springframework.beans.MutablePropertyValues; //导入方法依赖的package包/类
/**
* Constructs a new <code>SpringRefCollectionMetadata</code> instance.
*
* @param name
* @param definition
*/
public SimpleReferenceListMetadata(String name, BeanDefinition definition) {
super(name, definition);
MemberType type = MemberType.SERVICE_OBJECT;
MutablePropertyValues pvs = beanDefinition.getPropertyValues();
if (pvs.contains(MEMBER_TYPE_PROP)) {
type = (MemberType) MetadataUtils.getValue(pvs, MEMBER_TYPE_PROP);
}
memberType = type.ordinal() + 1;
}
示例10: SimpleReferenceListenerMetadata
import org.springframework.beans.MutablePropertyValues; //导入方法依赖的package包/类
public SimpleReferenceListenerMetadata(AbstractBeanDefinition beanDefinition) {
MutablePropertyValues pvs = beanDefinition.getPropertyValues();
bindMethodName = (String) MetadataUtils.getValue(pvs, BIND_PROP);
unbindMethodName = (String) MetadataUtils.getValue(pvs, UNBIND_PROP);
// listener reference
if (pvs.contains(LISTENER_NAME_PROP)) {
listenerComponent = new SimpleRefMetadata((String) MetadataUtils.getValue(pvs, LISTENER_NAME_PROP));
} else {
// convert the BeanDefinitionHolder
listenerComponent = (Target) ValueFactory.buildValue(MetadataUtils.getValue(pvs, LISTENER_PROP));
}
}
示例11: SimpleReferenceMetadata
import org.springframework.beans.MutablePropertyValues; //导入方法依赖的package包/类
/**
* Constructs a new <code>SpringUnaryServiceReferenceComponentMetadata</code> instance.
*
* @param name
* @param definition
*/
public SimpleReferenceMetadata(String name, BeanDefinition definition) {
super(name, definition);
MutablePropertyValues pvs = beanDefinition.getPropertyValues();
if (pvs.contains(TIMEOUT_PROP)) {
Object value = MetadataUtils.getValue(pvs, TIMEOUT_PROP);
timeout = Long
.parseLong((value instanceof String ? (String) value : ((TypedStringValue) value).getValue()));
} else {
timeout = DEFAULT_TIMEOUT;
}
}
示例12: SimpleRegistrationListener
import org.springframework.beans.MutablePropertyValues; //导入方法依赖的package包/类
public SimpleRegistrationListener(AbstractBeanDefinition beanDefinition) {
MutablePropertyValues pvs = beanDefinition.getPropertyValues();
registrationMethod = (String) MetadataUtils.getValue(pvs, REG_PROP);
unregistrationMethod = (String) MetadataUtils.getValue(pvs, UNREG_PROP);
// listener reference
if (pvs.contains(LISTENER_NAME_PROP)) {
listenerComponent = new SimpleRefMetadata((String) MetadataUtils.getValue(pvs, LISTENER_NAME_PROP));
} else {
// convert the BeanDefinitionHolder
listenerComponent = (Target) ValueFactory.buildValue(MetadataUtils.getValue(pvs, LISTENER_PROP));
}
}
示例13: SimpleServiceExportComponentMetadata
import org.springframework.beans.MutablePropertyValues; //导入方法依赖的package包/类
/**
* Constructs a new <code>SpringServiceExportComponentMetadata</code> instance.
*
* @param name bean name
* @param definition bean definition
*/
@SuppressWarnings("unchecked")
public SimpleServiceExportComponentMetadata(String name, BeanDefinition definition) {
super(name, definition);
MutablePropertyValues pvs = definition.getPropertyValues();
DefaultInterfaceDetector autoExp = (DefaultInterfaceDetector) MetadataUtils.getValue(pvs, AUTO_EXPORT_PROP);
// convert the internal numbers
autoExport = autoExp.ordinal() + 1;
// ranking
if (pvs.contains(RANKING_PROP)) {
String rank = (String) MetadataUtils.getValue(pvs, RANKING_PROP);
ranking = Integer.valueOf(rank).intValue();
} else {
ranking = 0;
}
// component
if (pvs.contains(SERVICE_NAME_PROP)) {
String compName = (String) MetadataUtils.getValue(pvs, SERVICE_NAME_PROP);
component = new SimpleRefMetadata(compName);
} else {
component = (Target) ValueFactory.buildValue(MetadataUtils.getValue(pvs, SERVICE_INSTANCE_PROP));
}
// interfaces
Object value = MetadataUtils.getValue(pvs, INTERFACES_PROP);
if (value != null) {
List<String> intfs = new ArrayList<String>(4);
// interface attribute used
if (value instanceof String) {
intfs.add((String) value);
}
else {
if (value instanceof Collection) {
Collection<TypedStringValue> values = (Collection) value;
for (TypedStringValue tsv : values) {
intfs.add(tsv.getValue());
}
}
}
interfaces = Collections.unmodifiableList(intfs);
} else {
interfaces = Collections.emptyList();
}
// service properties
if (pvs.contains(SERVICE_PROPERTIES_PROP)) {
Map props = (Map) MetadataUtils.getValue(pvs, SERVICE_PROPERTIES_PROP);
serviceProperties = ValueFactory.getEntries(props);
} else {
serviceProperties = Collections.emptyList();
}
// listeners
List<RegistrationListener> foundListeners = new ArrayList<RegistrationListener>(4);
List<? extends AbstractBeanDefinition> listenerDefinitions = (List) MetadataUtils.getValue(pvs, LISTENERS_PROP);
if (listenerDefinitions != null) {
for (AbstractBeanDefinition beanDef : listenerDefinitions) {
foundListeners.add(new SimpleRegistrationListener(beanDef));
}
}
listeners = Collections.unmodifiableCollection(foundListeners);
Boolean bool = (Boolean) MetadataUtils.getValue(pvs, LAZY_LISTENERS);
activation =
(bool != null ? (bool.booleanValue() ? ACTIVATION_LAZY : ACTIVATION_EAGER) : super.getActivation());
}
示例14: getProperty
import org.springframework.beans.MutablePropertyValues; //导入方法依赖的package包/类
/**
* This method overrides property retrieval in the scope of the
* GroovyBeanDefinitionReader to either:
* <ul>
* <li>Retrieve a variable from the bean builder's binding if it exists
* <li>Retrieve a RuntimeBeanReference for a specific bean if it exists
* <li>Otherwise just delegate to MetaClass.getProperty which will resolve
* properties from the GroovyBeanDefinitionReader itself
* </ul>
*/
public Object getProperty(String name) {
Binding binding = getBinding();
if (binding != null && binding.hasVariable(name)) {
return binding.getVariable(name);
}
else {
if (this.namespaces.containsKey(name)) {
return createDynamicElementReader(name);
}
if (getRegistry().containsBeanDefinition(name)) {
GroovyBeanDefinitionWrapper beanDefinition = (GroovyBeanDefinitionWrapper)
getRegistry().getBeanDefinition(name).getAttribute(GroovyBeanDefinitionWrapper.class.getName());
if (beanDefinition != null) {
return new GroovyRuntimeBeanReference(name, beanDefinition, false);
}
else {
return new RuntimeBeanReference(name, false);
}
}
// This is to deal with the case where the property setter is the last
// statement in a closure (hence the return value)
else if (this.currentBeanDefinition != null) {
MutablePropertyValues pvs = this.currentBeanDefinition.getBeanDefinition().getPropertyValues();
if (pvs.contains(name)) {
return pvs.get(name);
}
else {
DeferredProperty dp = this.deferredProperties.get(this.currentBeanDefinition.getBeanName() + name);
if (dp != null) {
return dp.value;
}
else {
return getMetaClass().getProperty(this, name);
}
}
}
else {
return getMetaClass().getProperty(this, name);
}
}
}
示例15: getProperty
import org.springframework.beans.MutablePropertyValues; //导入方法依赖的package包/类
/**
* This method overrides property retrieval in the scope of the
* {@code GroovyBeanDefinitionReader} to either:
* <ul>
* <li>Retrieve a variable from the bean builder's binding if it exists
* <li>Retrieve a RuntimeBeanReference for a specific bean if it exists
* <li>Otherwise just delegate to MetaClass.getProperty which will resolve
* properties from the {@code GroovyBeanDefinitionReader} itself
* </ul>
*/
public Object getProperty(String name) {
Binding binding = getBinding();
if (binding != null && binding.hasVariable(name)) {
return binding.getVariable(name);
}
else {
if (this.namespaces.containsKey(name)) {
return createDynamicElementReader(name);
}
if (getRegistry().containsBeanDefinition(name)) {
GroovyBeanDefinitionWrapper beanDefinition = (GroovyBeanDefinitionWrapper)
getRegistry().getBeanDefinition(name).getAttribute(GroovyBeanDefinitionWrapper.class.getName());
if (beanDefinition != null) {
return new GroovyRuntimeBeanReference(name, beanDefinition, false);
}
else {
return new RuntimeBeanReference(name, false);
}
}
// This is to deal with the case where the property setter is the last
// statement in a closure (hence the return value)
else if (this.currentBeanDefinition != null) {
MutablePropertyValues pvs = this.currentBeanDefinition.getBeanDefinition().getPropertyValues();
if (pvs.contains(name)) {
return pvs.get(name);
}
else {
DeferredProperty dp = this.deferredProperties.get(this.currentBeanDefinition.getBeanName() + name);
if (dp != null) {
return dp.value;
}
else {
return getMetaClass().getProperty(this, name);
}
}
}
else {
return getMetaClass().getProperty(this, name);
}
}
}