List of usage examples for org.springframework.expression.spel.support StandardTypeConverter StandardTypeConverter
public StandardTypeConverter(ConversionService conversionService)
From source file:org.ldaptive.beans.spring.SpringLdapEntryMapper.java
/** * Creates an evaluation context to use in the spring class descriptor. Adds * the default converters from the default conversion service. * * @param object to supply to the evaluation context * * @return evalutation context// ww w . j a v a 2 s. c o m */ protected EvaluationContext createEvaluationContext(final Object object) { final GenericConversionService conversionService = new GenericConversionService(); DefaultConversionService.addDefaultConverters(conversionService); if (converters != null) { for (Converter<?, ?> converter : converters) { conversionService.addConverter(converter); } } addDefaultConverters(conversionService); final StandardEvaluationContext context = new StandardEvaluationContext(object); context.setTypeConverter(new StandardTypeConverter(conversionService)); return context; }
From source file:org.opencredo.couchdb.outbound.CouchDbSendingMessageHandler.java
@Override protected void onInit() { BeanFactory beanFactory = this.getBeanFactory(); if (beanFactory != null) { this.evaluationContext.setBeanResolver(new BeanFactoryResolver(beanFactory)); }//from w w w .j a v a2 s . c o m ConversionService conversionService = this.getConversionService(); if (conversionService != null) { this.evaluationContext.setTypeConverter(new StandardTypeConverter(conversionService)); } }
From source file:org.craftercms.core.util.template.impl.spel.SpELStringTemplateCompiler.java
@PostConstruct public void init() { if (evalContext == null) { evalContext = new StandardEvaluationContext(); }//from w ww. j a v a 2 s . c om if (evalContext instanceof StandardEvaluationContext) { StandardEvaluationContext standardEvalContext = (StandardEvaluationContext) evalContext; // PropertyAccessor used when the model is a BeanFactory. standardEvalContext.addPropertyAccessor(new BeanFactoryAccessor()); if (beanFactory != null) { if (standardEvalContext.getBeanResolver() == null) { standardEvalContext.setBeanResolver(new BeanFactoryResolver(beanFactory)); } if (standardEvalContext.getTypeLocator() == null) { standardEvalContext.setTypeLocator(new StandardTypeLocator(beanFactory.getBeanClassLoader())); } if (standardEvalContext.getTypeConverter() == null) { ConversionService conversionService = beanFactory.getConversionService(); if (conversionService != null) { standardEvalContext.setTypeConverter(new StandardTypeConverter(conversionService)); } } } } }
From source file:org.shredzone.commons.view.impl.ViewServiceImpl.java
/** * Creates an {@link EvaluationContext} to be used for evaluation in this view * service. The default implementation creates a {@link ViewPathEvaluationContext}. * * @param context/*from w ww . ja va2 s .co m*/ * {@link PathContext} to be used as root object * @return {@link EvaluationContext} to be used for evaluation */ protected EvaluationContext createEvaluationContext(PathContext context) { ViewPathEvaluationContext evContext = new ViewPathEvaluationContext(context); evContext.setTypeConverter(new StandardTypeConverter(conversionService)); return evContext; }
From source file:org.springframework.data.gemfire.config.annotation.support.AbstractAnnotationConfigSupport.java
private void configureTypeConverter(EvaluationContext evaluationContext, BeanFactory beanFactory) { Optional.ofNullable(evaluationContext) .filter(evalContext -> evalContext instanceof StandardEvaluationContext) .ifPresent(evalContext -> Optional.ofNullable(beanFactory) .filter(it -> it instanceof ConfigurableBeanFactory) .map(it -> ((ConfigurableBeanFactory) it).getConversionService()) .ifPresent(conversionService -> ((StandardEvaluationContext) evalContext) .setTypeConverter(new StandardTypeConverter(conversionService)))); }
From source file:org.springframework.integration.expression.ExpressionUtils.java
/** * Create a {@link StandardEvaluationContext} with a {@link MapAccessor} in its * property accessor property and the supplied {@link ConversionService} in its * conversionService property.//from w w w .j a v a 2 s. c om * @param conversionService the conversion service. * @return the evaluation context. */ private static StandardEvaluationContext createStandardEvaluationContext(ConversionService conversionService, BeanFactory beanFactory) { StandardEvaluationContext evaluationContext = new StandardEvaluationContext(); evaluationContext.addPropertyAccessor(new MapAccessor()); if (conversionService != null) { evaluationContext.setTypeConverter(new StandardTypeConverter(conversionService)); } if (beanFactory != null) { evaluationContext.setBeanResolver(new BeanFactoryResolver(beanFactory)); } return evaluationContext; }