Tabnine Logo
Expression.getValueTypeDescriptor
Code IndexAdd Tabnine to your IDE (free)

How to use
getValueTypeDescriptor
method
in
org.springframework.expression.Expression

Best Java code snippets using org.springframework.expression.Expression.getValueTypeDescriptor (Showing top 20 results out of 315)

origin: spring-projects/spring-framework

@SuppressWarnings("unchecked")
@Test
public void resolveMapKeyValueTypes() {
  mapNotGeneric = new HashMap();
  mapNotGeneric.put("baseAmount", 3.11);
  mapNotGeneric.put("bonusAmount", 7.17);
  SpelExpressionParser parser = new SpelExpressionParser();
  Expression expression = parser.parseExpression("mapNotGeneric");
  assertEquals("@org.springframework.expression.spel.IndexingTests$FieldAnnotation java.util.HashMap<?, ?>", expression.getValueTypeDescriptor(this).toString());
}
origin: spring-projects/spring-framework

@SuppressWarnings("unchecked")
@Test
public void resolveCollectionElementType() {
  listNotGeneric = new ArrayList(2);
  listNotGeneric.add(5);
  listNotGeneric.add(6);
  SpelExpressionParser parser = new SpelExpressionParser();
  Expression expression = parser.parseExpression("listNotGeneric");
  assertEquals("@org.springframework.expression.spel.IndexingTests$FieldAnnotation java.util.ArrayList<?>", expression.getValueTypeDescriptor(this).toString());
  assertEquals("5,6", expression.getValue(this, String.class));
}
origin: spring-projects/spring-framework

@Test
public void indexIntoPropertyContainingListOfList() {
  List<List<Integer>> property = new ArrayList<>();
  property.add(Arrays.asList(3));
  this.parameterizedListOfList = property;
  SpelExpressionParser parser = new SpelExpressionParser();
  Expression expression = parser.parseExpression("parameterizedListOfList[0]");
  assertEquals("java.util.Arrays$ArrayList<java.lang.Integer>", expression.getValueTypeDescriptor(this).toString());
  assertEquals(property.get(0), expression.getValue(this));
  expression = parser.parseExpression("parameterizedListOfList[0][0]");
  assertEquals(3, expression.getValue(this));
}
origin: spring-projects/spring-framework

@Test
public void indexIntoPropertyContainingList() {
  List<Integer> property = new ArrayList<>();
  property.add(3);
  this.parameterizedList = property;
  SpelExpressionParser parser = new SpelExpressionParser();
  Expression expression = parser.parseExpression("parameterizedList");
  assertEquals("java.util.ArrayList<java.lang.Integer>", expression.getValueTypeDescriptor(this).toString());
  assertEquals(property, expression.getValue(this));
  expression = parser.parseExpression("parameterizedList[0]");
  assertEquals(3, expression.getValue(this));
}
origin: spring-projects/spring-framework

@Test
public void indexIntoGenericPropertyContainingList() {
  List<String> property = new ArrayList<>();
  property.add("bar");
  this.property = property;
  SpelExpressionParser parser = new SpelExpressionParser();
  Expression expression = parser.parseExpression("property");
  assertEquals("@org.springframework.expression.spel.IndexingTests$FieldAnnotation java.util.ArrayList<?>", expression.getValueTypeDescriptor(this).toString());
  assertEquals(property, expression.getValue(this));
  expression = parser.parseExpression("property[0]");
  assertEquals("bar", expression.getValue(this));
}
origin: spring-projects/spring-framework

@Test
public void indexIntoGenericPropertyContainingMap() {
  Map<String, String> property = new HashMap<>();
  property.put("foo", "bar");
  this.property = property;
  SpelExpressionParser parser = new SpelExpressionParser();
  Expression expression = parser.parseExpression("property");
  assertEquals("@org.springframework.expression.spel.IndexingTests$FieldAnnotation java.util.HashMap<?, ?>", expression.getValueTypeDescriptor(this).toString());
  assertEquals(property, expression.getValue(this));
  assertEquals(property, expression.getValue(this, Map.class));
  expression = parser.parseExpression("property['foo']");
  assertEquals("bar", expression.getValue(this));
}
origin: spring-projects/spring-framework

@Test
public void emptyList() {
  listOfScalarNotGeneric = new ArrayList();
  SpelExpressionParser parser = new SpelExpressionParser();
  Expression expression = parser.parseExpression("listOfScalarNotGeneric");
  assertEquals("java.util.ArrayList<?>", expression.getValueTypeDescriptor(this).toString());
  assertEquals("", expression.getValue(this, String.class));
}
origin: spring-projects/spring-framework

@Test
public void setPropertyContainingMap() {
  Map<Integer, Integer> property = new HashMap<>();
  property.put(9, 3);
  this.parameterizedMap = property;
  SpelExpressionParser parser = new SpelExpressionParser();
  Expression expression = parser.parseExpression("parameterizedMap");
  assertEquals("java.util.HashMap<java.lang.Integer, java.lang.Integer>", expression.getValueTypeDescriptor(this).toString());
  assertEquals(property, expression.getValue(this));
  expression = parser.parseExpression("parameterizedMap['9']");
  assertEquals(3, expression.getValue(this));
  expression.setValue(this, "37");
  assertEquals(37, expression.getValue(this));
}
origin: spring-projects/spring-framework

@Test
public void setPropertyContainingList() {
  List<Integer> property = new ArrayList<>();
  property.add(3);
  this.parameterizedList = property;
  SpelExpressionParser parser = new SpelExpressionParser();
  Expression expression = parser.parseExpression("parameterizedList");
  assertEquals("java.util.ArrayList<java.lang.Integer>", expression.getValueTypeDescriptor(this).toString());
  assertEquals(property, expression.getValue(this));
  expression = parser.parseExpression("parameterizedList[0]");
  assertEquals(3, expression.getValue(this));
  expression.setValue(this, "4");
  assertEquals(4, expression.getValue(this));
}
origin: spring-projects/spring-framework

@Test
public void setGenericPropertyContainingMap() {
  Map<String, String> property = new HashMap<>();
  property.put("foo", "bar");
  this.property = property;
  SpelExpressionParser parser = new SpelExpressionParser();
  Expression expression = parser.parseExpression("property");
  assertEquals("@org.springframework.expression.spel.IndexingTests$FieldAnnotation java.util.HashMap<?, ?>", expression.getValueTypeDescriptor(this).toString());
  assertEquals(property, expression.getValue(this));
  expression = parser.parseExpression("property['foo']");
  assertEquals("bar", expression.getValue(this));
  expression.setValue(this, "baz");
  assertEquals("baz", expression.getValue(this));
}
origin: spring-projects/spring-framework

@Test
public void setGenericPropertyContainingList() {
  List<Integer> property = new ArrayList<>();
  property.add(3);
  this.property = property;
  SpelExpressionParser parser = new SpelExpressionParser();
  Expression expression = parser.parseExpression("property");
  assertEquals("@org.springframework.expression.spel.IndexingTests$FieldAnnotation java.util.ArrayList<?>", expression.getValueTypeDescriptor(this).toString());
  assertEquals(property, expression.getValue(this));
  expression = parser.parseExpression("property[0]");
  assertEquals(3, expression.getValue(this));
  expression.setValue(this, "4");
  assertEquals("4", expression.getValue(this));
}
origin: spring-projects/spring-framework

@Test
public void indexIntoGenericPropertyContainingMapObject() {
  Map<String, Map<String, String>> property = new HashMap<>();
  Map<String, String> map = new HashMap<>();
  map.put("foo", "bar");
  property.put("property", map);
  SpelExpressionParser parser = new SpelExpressionParser();
  StandardEvaluationContext context = new StandardEvaluationContext();
  context.addPropertyAccessor(new MapAccessor());
  context.setRootObject(property);
  Expression expression = parser.parseExpression("property");
  assertEquals("java.util.HashMap<?, ?>", expression.getValueTypeDescriptor(context).toString());
  assertEquals(map, expression.getValue(context));
  assertEquals(map, expression.getValue(context, Map.class));
  expression = parser.parseExpression("property['foo']");
  assertEquals("bar", expression.getValue(context));
}
origin: spring-projects/spring-framework

@Test
public void indexIntoGenericPropertyContainingArray() {
  String[] property = new String[] { "bar" };
  this.property = property;
  SpelExpressionParser parser = new SpelExpressionParser();
  Expression expression = parser.parseExpression("property");
  assertEquals("@org.springframework.expression.spel.IndexingTests$FieldAnnotation java.lang.String[]", expression.getValueTypeDescriptor(this).toString());
  assertEquals(property, expression.getValue(this));
  expression = parser.parseExpression("property[0]");
  assertEquals("bar", expression.getValue(this));
}
origin: spring-projects/spring-framework

@Test
public void resolveCollectionElementTypeNull() {
  SpelExpressionParser parser = new SpelExpressionParser();
  Expression expression = parser.parseExpression("listNotGeneric");
  assertEquals("@org.springframework.expression.spel.IndexingTests$FieldAnnotation java.util.List<?>", expression.getValueTypeDescriptor(this).toString());
}
origin: spring-projects/spring-framework

@Test
public void setPropertyContainingMapAutoGrow() {
  SpelExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, false));
  Expression expression = parser.parseExpression("parameterizedMap");
  assertEquals("java.util.Map<java.lang.Integer, java.lang.Integer>", expression.getValueTypeDescriptor(this).toString());
  assertEquals(property, expression.getValue(this));
  expression = parser.parseExpression("parameterizedMap['9']");
  assertEquals(null, expression.getValue(this));
  expression.setValue(this, "37");
  assertEquals(37, expression.getValue(this));
}
origin: spring-projects/spring-framework

@Test
public void indexIntoGenericPropertyContainingGrowingList() {
  List<String> property = new ArrayList<>();
  this.property = property;
  SpelParserConfiguration configuration = new SpelParserConfiguration(true, true);
  SpelExpressionParser parser = new SpelExpressionParser(configuration);
  Expression expression = parser.parseExpression("property");
  assertEquals("@org.springframework.expression.spel.IndexingTests$FieldAnnotation java.util.ArrayList<?>", expression.getValueTypeDescriptor(this).toString());
  assertEquals(property, expression.getValue(this));
  expression = parser.parseExpression("property[0]");
  try {
    assertEquals("bar", expression.getValue(this));
  }
  catch (EvaluationException ex) {
    assertTrue(ex.getMessage().startsWith("EL1053E"));
  }
}
origin: spring-projects/spring-framework

@Test
public void indexIntoGenericPropertyContainingGrowingList2() {
  List<String> property2 = new ArrayList<>();
  this.property2 = property2;
  SpelParserConfiguration configuration = new SpelParserConfiguration(true, true);
  SpelExpressionParser parser = new SpelExpressionParser(configuration);
  Expression expression = parser.parseExpression("property2");
  assertEquals("java.util.ArrayList<?>", expression.getValueTypeDescriptor(this).toString());
  assertEquals(property2, expression.getValue(this));
  expression = parser.parseExpression("property2[0]");
  try {
    assertEquals("bar", expression.getValue(this));
  }
  catch (EvaluationException ex) {
    assertTrue(ex.getMessage().startsWith("EL1053E"));
  }
}
origin: spring-projects/spring-framework

@Test
public void indexIntoGenericPropertyContainingNullList() {
  SpelParserConfiguration configuration = new SpelParserConfiguration(true, true);
  SpelExpressionParser parser = new SpelExpressionParser(configuration);
  Expression expression = parser.parseExpression("property");
  assertEquals("@org.springframework.expression.spel.IndexingTests$FieldAnnotation java.lang.Object", expression.getValueTypeDescriptor(this).toString());
  assertEquals(property, expression.getValue(this));
  expression = parser.parseExpression("property[0]");
  try {
    assertEquals("bar", expression.getValue(this));
  }
  catch (EvaluationException ex) {
    assertTrue(ex.getMessage().startsWith("EL1027E"));
  }
}
origin: spring-projects/spring-framework

@Test
public void setGenericPropertyContainingListAutogrow() {
  List<Integer> property = new ArrayList<>();
  this.property = property;
  SpelExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true));
  Expression expression = parser.parseExpression("property");
  assertEquals("@org.springframework.expression.spel.IndexingTests$FieldAnnotation java.util.ArrayList<?>", expression.getValueTypeDescriptor(this).toString());
  assertEquals(property, expression.getValue(this));
  expression = parser.parseExpression("property[0]");
  try {
    expression.setValue(this, "4");
  }
  catch (EvaluationException ex) {
    assertTrue(ex.getMessage().startsWith("EL1053E"));
  }
}
origin: spring-projects/spring-framework

assertEquals(String.class,ex.getValueTypeDescriptor().getType());
assertEquals(String.class,ex.getValueTypeDescriptor(ctx).getType());
assertEquals(String.class,ex.getValueType(new Rooty()));
assertEquals(String.class,ex.getValueType(ctx, new Rooty()));
assertEquals(String.class,ex.getValueTypeDescriptor(new Rooty()).getType());
assertEquals(String.class,ex.getValueTypeDescriptor(ctx, new Rooty()).getType());
org.springframework.expressionExpressiongetValueTypeDescriptor

Javadoc

Return the most general type that can be passed to a #setValuemethod using the default context.

Popular methods of Expression

  • getValue
    Evaluate the expression in a specified context which can resolve references to properties, methods,
  • getExpressionString
    Return the original string used to create this expression (unmodified).
  • setValue
    Set this expression in the provided context to the value provided. The supplied root object override
  • getValueType
    Return the most general type that can be passed to the #setValue(EvaluationContext,Object,Object) me
  • isWritable
    Determine if an expression can be written to, i.e. setValue() can be called. The supplied root objec

Popular in Java

  • Running tasks concurrently on multiple threads
  • runOnUiThread (Activity)
  • getContentResolver (Context)
  • findViewById (Activity)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now