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() . 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 File: SpelReproTests.java    From spring-analysis-note with 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 File: SpelReproTests.java    From spring-analysis-note with 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 File: SpelReproTests.java    From spring-analysis-note with 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 File: SpelReproTests.java    From java-technology-stack with 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 File: SpelReproTests.java    From java-technology-stack with 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 File: SpelReproTests.java    From java-technology-stack with 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
Source File: SpelReproTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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
Source File: SpelReproTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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
Source File: SpelReproTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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());
}