Examples of TypedValue


Examples of org.springframework.expression.TypedValue

  @Test
  public void testEqualValues() throws Exception {
    StandardEvaluationContext context = new StandardEvaluationContext();
    HashMethodExecutor executor = new HashMethodExecutor();
    TypedValue value = executor.execute(context, new Object(), -3, -3);
    assertThat((String) value.getValue(), is("0_hash"));
    value = executor.execute(context, new Object(), -1, -1);
    assertThat((String) value.getValue(), is("0_hash"));
    value = executor.execute(context, new Object(), 1, 1);
    assertThat((String) value.getValue(), is("0_hash"));
  }
View Full Code Here

Examples of org.springframework.expression.TypedValue

  @Test
  public void testNegativeBucketSize() throws Exception {
    StandardEvaluationContext context = new StandardEvaluationContext();
    HashMethodExecutor executor = new HashMethodExecutor();
    TypedValue value = executor.execute(context, new Object(), 3, -2);
    assertThat((String) value.getValue(), is("1_hash"));
  }
View Full Code Here

Examples of org.springframework.expression.TypedValue

  @Test
  public void testNegativeHashcode() throws Exception {
    StandardEvaluationContext context = new StandardEvaluationContext();
    HashMethodExecutor executor = new HashMethodExecutor();
    TypedValue value = executor.execute(context, new Object(), -9, 2);
    assertThat((String) value.getValue(), is("1_hash"));
  }
View Full Code Here

Examples of org.springframework.expression.TypedValue

  @Test
  public void testNegativeHashcodeBucketSizeBigger() throws Exception {
    StandardEvaluationContext context = new StandardEvaluationContext();
    HashMethodExecutor executor = new HashMethodExecutor();
    TypedValue value = executor.execute(context, new Object(), -9, 12);
    assertThat((String) value.getValue(), is("9_hash"));
    value = executor.execute(context, new Object(), -9, 24);
    assertThat((String) value.getValue(), is("9_hash"));
    value = executor.execute(context, new Object(), -9, 27);
    assertThat((String) value.getValue(), is("9_hash"));
  }
View Full Code Here

Examples of org.springframework.expression.TypedValue

      if (target instanceof EvaluationContextExtensionAdapter) {
        return lookupPropertyFrom(((EvaluationContextExtensionAdapter) target), name);
      }

      if (adapterMap.containsKey(name)) {
        return new TypedValue(adapterMap.get(name));
      }

      for (EvaluationContextExtensionAdapter extension : adapters) {

        Map<String, Object> properties = extension.getProperties();
View Full Code Here

Examples of org.springframework.expression.TypedValue

    private TypedValue lookupPropertyFrom(EvaluationContextExtensionAdapter extension, String name) {

      Object value = extension.getProperties().get(name);

      if (!(value instanceof Function)) {
        return new TypedValue(value);
      }

      Function function = (Function) value;

      try {
        return new TypedValue(function.invoke(new Object[0]));
      } catch (Exception e) {
        throw new SpelEvaluationException(e, SpelMessage.FUNCTION_REFERENCE_CANNOT_BE_INVOKED, name,
            function.getDeclaringClass());
      }
    }
View Full Code Here

Examples of org.springframework.expression.TypedValue

     */
    @Override
    public TypedValue execute(EvaluationContext context, Object target, Object... arguments) throws AccessException {

      try {
        return new TypedValue(function.invoke(arguments));
      } catch (Exception e) {
        throw new SpelEvaluationException(e, SpelMessage.FUNCTION_REFERENCE_CANNOT_BE_INVOKED, function.getName(),
            function.getDeclaringClass());
      }
    }
View Full Code Here

Examples of org.springframework.expression.TypedValue

  @Override
  public TypedValue read(final EvaluationContext context, final Object target, final String name) {
    Map<String, Object> source = (Map<String, Object>) target;

    Object value = source.get(name);
    return value == null ? TypedValue.NULL : new TypedValue(value);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.