From 37957aee1e1f6254e5fd03c57e37baf10cfdbbac Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Sun, 10 Oct 2010 21:29:18 +0000 Subject: [PATCH] revised TypedValue toString representation (SPR-7569) git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3733 50f2f4bb-b051-0410-bef5-90022cba6387 --- .../java/org/springframework/expression/TypedValue.java | 9 +++++---- .../expression/spel/support/ReflectionHelperTests.java | 5 ++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/org.springframework.expression/src/main/java/org/springframework/expression/TypedValue.java b/org.springframework.expression/src/main/java/org/springframework/expression/TypedValue.java index 99ed027a5cd..f3bed382e64 100644 --- a/org.springframework.expression/src/main/java/org/springframework/expression/TypedValue.java +++ b/org.springframework.expression/src/main/java/org/springframework/expression/TypedValue.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,10 +20,11 @@ import org.springframework.core.convert.TypeDescriptor; /** * Encapsulates an object and a type descriptor that describes it. - * The type descriptor can hold generic information that would - * not be accessible through a simple getClass() call on the object. + * The type descriptor can hold generic information that would not be + * accessible through a simple getClass() call on the object. * * @author Andy Clement + * @author Juergen Hoeller * @since 3.0 */ public class TypedValue { @@ -72,7 +73,7 @@ public class TypedValue { @Override public String toString() { StringBuilder str = new StringBuilder(); - str.append("TypedValue: ").append(this.value).append(" of ").append(this.getTypeDescriptor()); + str.append("TypedValue: '").append(this.value).append("' of [").append(getTypeDescriptor() + "]"); return str.toString(); } diff --git a/org.springframework.expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java b/org.springframework.expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java index fe64171a7af..42cdc2b4012 100644 --- a/org.springframework.expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java +++ b/org.springframework.expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java @@ -25,6 +25,7 @@ import java.util.List; import junit.framework.Assert; import org.junit.Test; +import org.springframework.core.convert.TypeDescriptor; import org.springframework.expression.EvaluationContext; import org.springframework.expression.ParseException; import org.springframework.expression.PropertyAccessor; @@ -36,8 +37,6 @@ import org.springframework.expression.spel.SpelUtilities; import org.springframework.expression.spel.ast.FormatHelper; import org.springframework.expression.spel.standard.SpelExpression; import org.springframework.expression.spel.support.ReflectionHelper.ArgsMatchKind; -import org.springframework.core.convert.TypeDescriptor; -import org.springframework.core.MethodParameter; /** * Tests for any helper code. @@ -99,7 +98,7 @@ public class ReflectionHelperTests extends ExpressionTestCase { public void testTypedValue() { TypedValue tValue = new TypedValue("hello"); Assert.assertEquals(String.class,tValue.getTypeDescriptor().getType()); - Assert.assertEquals("TypedValue: hello of [TypeDescriptor java.lang.String]",tValue.toString()); + Assert.assertEquals("TypedValue: 'hello' of [java.lang.String]",tValue.toString()); } @Test