Spring Framework BeanExpressionContext - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework BeanExpressionContext class.

This code example shows how to use the following methods:getObject
		return ((BeanExpressionContext) target).containsObject(name);
	} 
 
	@Override 
	public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException {
		return new TypedValue(((BeanExpressionContext) target).getObject(name));
	} 
 
	@Override 
	public boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException {
		return false; 
	} 
 
	@Override 
	public void write(EvaluationContext context, Object target, String name, Object newValue) throws AccessException {
		throw new AccessException("Beans in a BeanFactory are read-only"); 
	} 
 
	@Override 
	public Class<?>[] getSpecificTargetClasses() {
6
CodeRank
This code example shows how to use the following methods:
	 * and #{...} SpEL expressions in default values, or {@code null} if default 
	 * values are not expected to contain expressions 
	 */ 
	public AbstractNamedValueMethodArgumentResolver(ConfigurableBeanFactory beanFactory) {
		this.configurableBeanFactory = beanFactory;
		this.expressionContext = (beanFactory != null ? new BeanExpressionContext(beanFactory, new RequestScope()) : null);
	} 
 
 
	@Override 
	public final Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
			NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
 
		Class<?> paramType = parameter.getParameterType();
		NamedValueInfo namedValueInfo = getNamedValueInfo(parameter);
 
		Object arg = resolveName(namedValueInfo.name, parameter, webRequest);
		if (arg == null) {
			if (namedValueInfo.defaultValue != null) {
				arg = resolveDefaultValue(namedValueInfo.defaultValue);
5
CodeRank
This code example shows how to use the following methods:
	 * values are not expected to contain expressions 
	 */ 
	protected AbstractNamedValueMethodArgumentResolver(ConversionService cs, ConfigurableBeanFactory beanFactory) {
		this.conversionService = (cs != null ? cs : new DefaultConversionService());
		this.configurableBeanFactory = beanFactory;
		this.expressionContext = (beanFactory != null ? new BeanExpressionContext(beanFactory, null) : null);
	} 
 
 
	@Override 
	public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception {
		Class<?> paramType = parameter.getParameterType();
		NamedValueInfo namedValueInfo = getNamedValueInfo(parameter);
 
		Object arg = resolveArgumentInternal(parameter, message, namedValueInfo.name);
		if (arg == null) {
			if (namedValueInfo.defaultValue != null) {
				arg = resolveDefaultValue(namedValueInfo.defaultValue);
			} 
			else if (namedValueInfo.required && !parameter.getParameterType().getName().equals("java.util.Optional")) {
5
CodeRank
This code example shows how to use the following methods:
	@Override 
	public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
		this.beanFactory = beanFactory;
		if (beanFactory instanceof ConfigurableListableBeanFactory) {
			this.resolver = ((ConfigurableListableBeanFactory) beanFactory).getBeanExpressionResolver();
			this.expressionContext = new BeanExpressionContext((ConfigurableListableBeanFactory) beanFactory, null);
		} 
	} 
 
	@Override 
	public void setEnvironment(Environment environment) {
		this.environment = environment;
	} 
 
	@Override 
	public void setImportMetadata(AnnotationMetadata importMetadata) {
		Map<String, Object> map = importMetadata.getAnnotationAttributes(EnableIntegrationMBeanExport.class.getName());
		this.attributes = AnnotationAttributes.fromMap(map);
		Assert.notNull(this.attributes,
				"@EnableIntegrationMBeanExport is not present on importing class " + importMetadata.getClassName());
5
CodeRank