List of usage examples for org.springframework.beans ConfigurablePropertyAccessor setPropertyValue
void setPropertyValue(String propertyName, @Nullable Object value) throws BeansException;
From source file:org.lightadmin.core.config.bootstrap.RepositoriesFactoryBean.java
private Repositories configureRepositories(Repositories repositories) { ConfigurablePropertyAccessor configurablePropertyAccessor = forDirectFieldAccess(repositories); ListableBeanFactory beanFactory = (ListableBeanFactory) getBeanFactory(); configurablePropertyAccessor.setPropertyValue("beanFactory", beanFactory); configurablePropertyAccessor.setPropertyValue("repositoryBeanNames", repositoryBeanNames(beanFactory)); configurablePropertyAccessor.setPropertyValue("repositoryFactoryInfos", repositoryFactoryInfos(beanFactory)); return repositories; }
From source file:org.brushingbits.jnap.validation.constraints.AbstractConstraintValidator.java
/** * This method copies all the annotation properties to fields with the same name. * /*from w w w . j a v a 2s . c om*/ * @param constraintAnnotation This constraint annotation. * @see PropertyAccessorFactory */ protected void bindParameters(A constraintAnnotation) { Class<?> annotationClass = constraintAnnotation.getClass(); Method[] methods = annotationClass.getDeclaredMethods(); ConfigurablePropertyAccessor accessor = PropertyAccessorFactory.forDirectFieldAccess(this); try { for (Method method : methods) { String methodName = method.getName(); if (accessor.isWritableProperty(methodName)) { accessor.setPropertyValue(methodName, method.invoke(constraintAnnotation, ArrayUtils.EMPTY_OBJECT_ARRAY)); } } } catch (Exception e) { ReflectionUtils.handleReflectionException(e); } }