Java Code Examples for org.springframework.expression.spel.standard.SpelExpression#getValueTypeDescriptor()

The following examples show how to use org.springframework.expression.spel.standard.SpelExpression#getValueTypeDescriptor() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: spring-analysis-note   File: SpelReproTests.java    License: MIT License 5 votes vote down vote up
@Test
public void projectionTypeDescriptors_1() {
	StandardEvaluationContext context = new StandardEvaluationContext(new C());
	SpelExpressionParser parser = new SpelExpressionParser();
	String el1 = "ls.![#this.equals('abc')]";
	SpelExpression exp = parser.parseRaw(el1);
	List<?> value = (List<?>) exp.getValue(context);
	// value is list containing [true,false]
	assertEquals(Boolean.class, value.get(0).getClass());
	TypeDescriptor evaluated = exp.getValueTypeDescriptor(context);
	assertEquals(null, evaluated.getElementTypeDescriptor());
}
 
Example 2
Source Project: spring-analysis-note   File: SpelReproTests.java    License: MIT License 5 votes vote down vote up
@Test
public void projectionTypeDescriptors_2() {
	StandardEvaluationContext context = new StandardEvaluationContext(new C());
	SpelExpressionParser parser = new SpelExpressionParser();
	String el1 = "as.![#this.equals('abc')]";
	SpelExpression exp = parser.parseRaw(el1);
	Object[] value = (Object[]) exp.getValue(context);
	// value is array containing [true,false]
	assertEquals(Boolean.class, value[0].getClass());
	TypeDescriptor evaluated = exp.getValueTypeDescriptor(context);
	assertEquals(Boolean.class, evaluated.getElementTypeDescriptor().getType());
}
 
Example 3
Source Project: spring-analysis-note   File: SpelReproTests.java    License: MIT License 5 votes vote down vote up
@Test
public void projectionTypeDescriptors_3() {
	StandardEvaluationContext context = new StandardEvaluationContext(new C());
	SpelExpressionParser parser = new SpelExpressionParser();
	String el1 = "ms.![key.equals('abc')]";
	SpelExpression exp = parser.parseRaw(el1);
	List<?> value = (List<?>) exp.getValue(context);
	// value is list containing [true,false]
	assertEquals(Boolean.class, value.get(0).getClass());
	TypeDescriptor evaluated = exp.getValueTypeDescriptor(context);
	assertEquals(null, evaluated.getElementTypeDescriptor());
}
 
Example 4
Source Project: java-technology-stack   File: SpelReproTests.java    License: MIT License 5 votes vote down vote up
@Test
public void projectionTypeDescriptors_1() {
	StandardEvaluationContext context = new StandardEvaluationContext(new C());
	SpelExpressionParser parser = new SpelExpressionParser();
	String el1 = "ls.![#this.equals('abc')]";
	SpelExpression exp = parser.parseRaw(el1);
	List<?> value = (List<?>) exp.getValue(context);
	// value is list containing [true,false]
	assertEquals(Boolean.class, value.get(0).getClass());
	TypeDescriptor evaluated = exp.getValueTypeDescriptor(context);
	assertEquals(null, evaluated.getElementTypeDescriptor());
}
 
Example 5
Source Project: java-technology-stack   File: SpelReproTests.java    License: MIT License 5 votes vote down vote up
@Test
public void projectionTypeDescriptors_2() {
	StandardEvaluationContext context = new StandardEvaluationContext(new C());
	SpelExpressionParser parser = new SpelExpressionParser();
	String el1 = "as.![#this.equals('abc')]";
	SpelExpression exp = parser.parseRaw(el1);
	Object[] value = (Object[]) exp.getValue(context);
	// value is array containing [true,false]
	assertEquals(Boolean.class, value[0].getClass());
	TypeDescriptor evaluated = exp.getValueTypeDescriptor(context);
	assertEquals(Boolean.class, evaluated.getElementTypeDescriptor().getType());
}
 
Example 6
Source Project: java-technology-stack   File: SpelReproTests.java    License: MIT License 5 votes vote down vote up
@Test
public void projectionTypeDescriptors_3() {
	StandardEvaluationContext context = new StandardEvaluationContext(new C());
	SpelExpressionParser parser = new SpelExpressionParser();
	String el1 = "ms.![key.equals('abc')]";
	SpelExpression exp = parser.parseRaw(el1);
	List<?> value = (List<?>) exp.getValue(context);
	// value is list containing [true,false]
	assertEquals(Boolean.class, value.get(0).getClass());
	TypeDescriptor evaluated = exp.getValueTypeDescriptor(context);
	assertEquals(null, evaluated.getElementTypeDescriptor());
}
 
Example 7
@Test
public void projectionTypeDescriptors_1() throws Exception {
	StandardEvaluationContext ctx = new StandardEvaluationContext(new C());
	SpelExpressionParser parser = new SpelExpressionParser();
	String el1 = "ls.![#this.equals('abc')]";
	SpelExpression exp = parser.parseRaw(el1);
	List<?> value = (List<?>) exp.getValue(ctx);
	// value is list containing [true,false]
	assertEquals(Boolean.class, value.get(0).getClass());
	TypeDescriptor evaluated = exp.getValueTypeDescriptor(ctx);
	assertEquals(null, evaluated.getElementTypeDescriptor());
}
 
Example 8
@Test
public void projectionTypeDescriptors_2() throws Exception {
	StandardEvaluationContext ctx = new StandardEvaluationContext(new C());
	SpelExpressionParser parser = new SpelExpressionParser();
	String el1 = "as.![#this.equals('abc')]";
	SpelExpression exp = parser.parseRaw(el1);
	Object[] value = (Object[]) exp.getValue(ctx);
	// value is array containing [true,false]
	assertEquals(Boolean.class, value[0].getClass());
	TypeDescriptor evaluated = exp.getValueTypeDescriptor(ctx);
	assertEquals(Boolean.class, evaluated.getElementTypeDescriptor().getType());
}
 
Example 9
@Test
public void projectionTypeDescriptors_3() throws Exception {
	StandardEvaluationContext ctx = new StandardEvaluationContext(new C());
	SpelExpressionParser parser = new SpelExpressionParser();
	String el1 = "ms.![key.equals('abc')]";
	SpelExpression exp = parser.parseRaw(el1);
	List<?> value = (List<?>) exp.getValue(ctx);
	// value is list containing [true,false]
	assertEquals(Boolean.class, value.get(0).getClass());
	TypeDescriptor evaluated = exp.getValueTypeDescriptor(ctx);
	assertEquals(null, evaluated.getElementTypeDescriptor());
}