Spring Framework MapAccessor - 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 MapAccessor class.

This code example shows how to use the following methods:
	 * @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;
	} 
 
	/** 
	 * Used to create a context with no BeanFactory, usually in tests. 
	 * @return The evaluation context. 
	 */ 
	public static StandardEvaluationContext createStandardEvaluationContext() { 
6
CodeRank
This code example shows how to use the following methods:
    private Object target;
 
    public MapWrapper(Object target) throws Exception {
        this.target = target;
        context = new StandardEvaluationContext();
        context.addPropertyAccessor(new MapAccessor());
        parser = new SpelExpressionParser();
    } 
 
    @SuppressWarnings("unchecked") 
    public Map<String, Object> getMap() {
        return (Map<String, Object>) target;
    } 
 
    public Object get(String expression) throws Exception {
        return get(expression, Object.class);
    } 
 
    public <T> T get(String expression, Class<T> type) throws Exception {
        return parser.parseExpression(expression).getValue(context, target,
6
CodeRank
This code example shows how to use the following methods:
 
		Assert.notNull(configuration, "Hadoop configuration must not be null");
 
		fsShell = new FsShell(configuration);
 
		this.evaluationContext.addPropertyAccessor(new MapAccessor());
 
		final BeanFactory beanFactory = this.getBeanFactory();
 
		if (beanFactory != null) {
			this.evaluationContext.setBeanResolver(new BeanFactoryResolver(
					beanFactory));
		} 
 
		if (this.destinationDirectoryExpression instanceof LiteralExpression) {
			final Path directory = new Path(
					this.destinationDirectoryExpression.getValue(
							this.evaluationContext, null, String.class));
			validateDestinationDirectory(directory, this.autoCreateDirectory);
		} 
5
CodeRank
This code example shows how to use the following methods:
 
		Assert.notNull(configuration, "Hadoop configuration must not be null");
 
		fsShell = new FsShell(configuration);
 
		this.evaluationContext.addPropertyAccessor(new MapAccessor());
 
		final BeanFactory beanFactory = this.getBeanFactory();
 
		if (beanFactory != null) {
			this.evaluationContext.setBeanResolver(new BeanFactoryResolver(
					beanFactory));
		} 
 
		if (this.destinationDirectoryExpression instanceof LiteralExpression) {
			final Path directory = new Path(
					this.destinationDirectoryExpression.getValue(
							this.evaluationContext, null, String.class));
			validateDestinationDirectory(directory, this.autoCreateDirectory);
		} 
5
CodeRank
This code example shows how to use the following methods:
	 * @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;
	} 
 
	/** 
	 * Used to create a context with no BeanFactory, usually in tests. 
	 * @return The evaluation context. 
	 */ 
	public static StandardEvaluationContext createStandardEvaluationContext() { 
4
CodeRank
This code example shows how to use the following methods:
			target = new MappingJsonFactory().createJsonParser(content.replace("\\","/")).readValueAs(Map.class);
		} catch (JsonParseException e) {
			throw new JsonMappingException("Cannot create wrapper for:\n"+content, e);
		} 
		context = new StandardEvaluationContext();
		context.addPropertyAccessor(new MapAccessor());
		parser = new SpelExpressionParser();
	} 
 
	public Map<String,Object> getMap() {
		return target;
	} 
 
	public Object get(String expression) throws Exception {
		return get(expression, Object.class);
	} 
 
	public <T> T get(String expression, Class<T> type) throws Exception {
		return parser.parseExpression(expression).getValue(context, target, type);
	} 
5
CodeRank
This code example shows how to use the following methods:
     * {@link org.springframework.expression.spel.support.ReflectivePropertyAccessor ReflectivePropertyAccessor} 
     * and {@link MapAccessor}. 
     */ 
    public SpelMessageInterpolator() { 
        StandardEvaluationContext ctx = new StandardEvaluationContext(); 
        ctx.addPropertyAccessor(new MapAccessor()); 
        this.evalContext = ctx; 
    } 
 
 
    public String interpolate(String messageTemplate, Map<String, Object> variables) { 
        Assert.notNull(messageTemplate, "messageTemplate must not be null"); 
 
        try { 
            Expression expression = parser().parseExpression(messageTemplate, new TemplateParserContext()); 
 
            return expression.getValue(evalContext, variables, String.class); 
 
        } catch (ExpressionException ex) { 
            LOG.error("Failed to interpolate message template: {}", messageTemplate, ex); 
5
CodeRank
This code example shows how to use the following methods:
 
	@SuppressWarnings("unchecked") 
	public JsonWrapper(String content) throws Exception {
		target = new MappingJsonFactory().createJsonParser(content).readValueAs(Map.class);
		context = new StandardEvaluationContext();
		context.addPropertyAccessor(new MapAccessor());
		parser = new SpelExpressionParser();
	} 
 
	public Object get(String expression) throws Exception {
		return get(expression, Object.class);
	} 
 
	@SuppressWarnings("unchecked") 
	public <T> T get(String expression, Class<T> type) throws Exception {
		return (T) parser.parseExpression(expression).getValue(context, target);
	} 
	 
	@Override 
	public String toString() {
5
CodeRank
This code example shows how to use the following methods:
 
    private final EvaluationContext delegate; 
    private final List<PropertyAccessor> propertyAccessors; 
    private Map<String,Object> additionalVariables; 
 
    public static final MapAccessor MAP_ACCESSOR_INSTANCE = new MapAccessor(); 
 
    public ThymeleafEvaluationContextWrapper(final EvaluationContext delegate) { 
        this(delegate, null); 
    } 
 
 
    public ThymeleafEvaluationContextWrapper(final EvaluationContext delegate, final Map<String,Object> additionalVariables) { 
         
        super(); 
 
        Validate.notNull(delegate, "Evaluation context delegate cannot be null"); 
 
        this.delegate = delegate; 
 
3
CodeRank
This code example shows how to use the following methods:
 */ 
public final class ThymeleafEvaluationContext extends StandardEvaluationContext { 
 
    public static final String THYMELEAF_EVALUATION_CONTEXT_CONTEXT_VARIABLE_NAME = "thymeleafEvaluationContext"; 
 
    public static final MapAccessor MAP_ACCESSOR_INSTANCE = new MapAccessor(); 
 
    public ThymeleafEvaluationContext(final BeanFactory beanFactory, final ConversionService conversionService) { 
         
        super(); 
 
        Validate.notNull(beanFactory, "Bean factory cannot be null"); 
        // ConversionService CAN be null 
 
        this.setBeanResolver(new BeanFactoryResolver(beanFactory)); 
        if (conversionService != null) { 
            this.setTypeConverter(new StandardTypeConverter(conversionService)); 
        } 
 
        this.addPropertyAccessor(VariablesMapPropertyAccessor.INSTANCE); 
4
CodeRank
See Code Examples for Spring Framework MapAccessor Methods: