From 55a2554cc88a67d555e54450bec45d2005cd1e40 Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Sun, 11 Jun 2006 21:49:42 +0000 Subject: [PATCH] toString() override. Debuggers like them. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@413537 13f79535-47bb-0310-9956-ffa450edef68 --- .../ant/types/resources/PropertyResource.java | 14 ++++++++++++++ .../tools/ant/types/resources/StringResource.java | 13 +++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/main/org/apache/tools/ant/types/resources/PropertyResource.java b/src/main/org/apache/tools/ant/types/resources/PropertyResource.java index b99b7eb64..2874d1707 100644 --- a/src/main/org/apache/tools/ant/types/resources/PropertyResource.java +++ b/src/main/org/apache/tools/ant/types/resources/PropertyResource.java @@ -97,6 +97,20 @@ public class PropertyResource extends Resource { return super.hashCode() * PROPERTY_MAGIC; } + /** + * Get the string. + * + * @return the string contents of the resource. + * @since Ant 1.7 + */ + public String toString() { + if (isReference()) { + return getCheckedRef().toString(); + } + return getName()!=null?("${"+getName()+"}") + :"null"; + } + /** * Get an InputStream for the Resource. * @return an InputStream containing this Resource's content. diff --git a/src/main/org/apache/tools/ant/types/resources/StringResource.java b/src/main/org/apache/tools/ant/types/resources/StringResource.java index 05947a7e9..01c67fa06 100644 --- a/src/main/org/apache/tools/ant/types/resources/StringResource.java +++ b/src/main/org/apache/tools/ant/types/resources/StringResource.java @@ -127,6 +127,19 @@ public class StringResource extends Resource { return super.hashCode() * STRING_MAGIC; } + /** + * Get the string. + * + * @return the string contents of the resource. + * @since Ant 1.7 + */ + public String toString() { + if (isReference()) { + return getCheckedRef().toString(); + } + return String.valueOf(getContent()); + } + /** * Get an InputStream for the Resource. * @return an InputStream containing this Resource's content.