Package org.springframework.binding.expression

Examples of org.springframework.binding.expression.ParserContext


  }

  private Action parseRenderAction(RenderModel render) {
    String[] fragmentExpressionStrings = StringUtils.commaDelimitedListToStringArray(render.getFragments());
    fragmentExpressionStrings = StringUtils.trimArrayElements(fragmentExpressionStrings);
    ParserContext context = new FluentParserContext().template().evaluate(RequestContext.class).expectResult(
        String.class);
    Expression[] fragments = new Expression[fragmentExpressionStrings.length];
    for (int i = 0; i < fragmentExpressionStrings.length; i++) {
      String fragment = fragmentExpressionStrings[i];
      fragments[i] = getLocalContext().getExpressionParser().parseExpression(fragment, context);
View Full Code Here


    public void mapVariables(ExpressionVariable[] variables, ExpressionFactory expressionFactory) {
      if (variables != null && variables.length > 0) {
        variableMapper = new VariableMapperImpl();
        for (int i = 0; i < variables.length; i++) {
          ExpressionVariable var = variables[i];
          ParserContext context = var.getParserContext() != null ? var.getParserContext()
              : NullParserContext.INSTANCE;
          ValueExpression expr;
          if (context.isTemplate()) {
            expr = parseValueExpression(var.getValueExpression(), context);
          } else {
            assertNotDelimited(var.getValueExpression());
            assertHasText(var.getValueExpression());
            expr = parseValueExpression("#{" + var.getValueExpression() + "}", context);
View Full Code Here

    }
  }

  private void addMapping(DefaultMapper mapper, Binding binding, Object model) {
    Expression source = new RequestParameterExpression(binding.getProperty());
    ParserContext parserContext = new FluentParserContext().evaluate(model.getClass());
    Expression target = expressionParser.parseExpression(binding.getProperty(), parserContext);
    DefaultMapping mapping = new DefaultMapping(source, target);
    mapping.setRequired(binding.getRequired());
    if (binding.getConverter() != null) {
      ConversionExecutor conversionExecutor = conversionService.getConversionExecutor(binding.getConverter(),
View Full Code Here

      }
    }
  }

  private void addEmptyValueMapping(DefaultMapper mapper, String field, Object model) {
    ParserContext parserContext = new FluentParserContext().evaluate(model.getClass());
    Expression target = expressionParser.parseExpression(field, parserContext);
    try {
      Class propertyType = target.getValueType(model);
      Expression source = new StaticExpression(getEmptyValue(propertyType));
      DefaultMapping mapping = new DefaultMapping(source, target);
View Full Code Here

    }
  }

  private void addDefaultMapping(DefaultMapper mapper, String parameter, Object model) {
    Expression source = new RequestParameterExpression(parameter);
    ParserContext parserContext = new FluentParserContext().evaluate(model.getClass());
    Expression target = expressionParser.parseExpression(parameter, parserContext);
    DefaultMapping mapping = new DefaultMapping(source, target);
    if (logger.isDebugEnabled()) {
      logger.debug("Adding default mapping for parameter '" + parameter + "'");
    }
View Full Code Here

   * @param binding the binding element
   * @param model the model
   */
  protected void addMapping(DefaultMapper mapper, Binding binding, Object model) {
    Expression source = new RequestParameterExpression(binding.getProperty());
    ParserContext parserContext = new FluentParserContext().evaluate(model.getClass());
    Expression target = expressionParser.parseExpression(binding.getProperty(), parserContext);
    DefaultMapping mapping = new DefaultMapping(source, target);
    mapping.setRequired(binding.getRequired());
    if (binding.getConverter() != null) {
      Assert.notNull(conversionService,
View Full Code Here

   * @param mapper the mapper to add the mapping to
   * @param field the field for which a mapping is to be added
   * @param model the model
   */
  protected void addEmptyValueMapping(DefaultMapper mapper, String field, Object model) {
    ParserContext parserContext = new FluentParserContext().evaluate(model.getClass());
    Expression target = expressionParser.parseExpression(field, parserContext);
    try {
      Class<?> propertyType = target.getValueType(model);
      Expression source = new StaticExpression(getEmptyValue(propertyType));
      DefaultMapping mapping = new DefaultMapping(source, target);
View Full Code Here

   * @param parameter the request parameter name
   * @param model the model
   */
  protected void addDefaultMapping(DefaultMapper mapper, String parameter, Object model) {
    Expression source = new RequestParameterExpression(parameter);
    ParserContext parserContext = new FluentParserContext().evaluate(model.getClass());
    Expression target = expressionParser.parseExpression(parameter, parserContext);
    DefaultMapping mapping = new DefaultMapping(source, target);
    if (logger.isDebugEnabled()) {
      logger.debug("Adding default mapping for parameter '" + parameter + "'");
    }
View Full Code Here

  }

  private Action parseRenderAction(RenderModel render) {
    String[] fragmentExpressionStrings = StringUtils.commaDelimitedListToStringArray(render.getFragments());
    fragmentExpressionStrings = StringUtils.trimArrayElements(fragmentExpressionStrings);
    ParserContext context = new FluentParserContext().template().evaluate(RequestContext.class)
        .expectResult(String.class);
    Expression[] fragments = new Expression[fragmentExpressionStrings.length];
    for (int i = 0; i < fragmentExpressionStrings.length; i++) {
      String fragment = fragmentExpressionStrings[i];
      fragments[i] = getLocalContext().getExpressionParser().parseExpression(fragment, context);
View Full Code Here

    public void mapVariables(ExpressionVariable[] variables, ExpressionFactory expressionFactory) {
      if (variables != null && variables.length > 0) {
        variableMapper = new VariableMapperImpl();
        for (ExpressionVariable var : variables) {
          ParserContext context = var.getParserContext() != null ? var.getParserContext()
              : NullParserContext.INSTANCE;
          ValueExpression expr;
          if (context.isTemplate()) {
            expr = parseValueExpression(var.getValueExpression(), context);
          } else {
            assertNotDelimited(var.getValueExpression());
            assertHasText(var.getValueExpression());
            expr = parseValueExpression("#{" + var.getValueExpression() + "}", context);
View Full Code Here

TOP

Related Classes of org.springframework.binding.expression.ParserContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.