From 96380e9129359bef781d850165b567ccb56cd7c3 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Fri, 11 Oct 2013 18:03:27 +0000 Subject: [PATCH] LUCENE-5275: Change AttributeSource.toString to display the current state of attributes git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1531376 13f79535-47bb-0310-9956-ffa450edef68 --- lucene/CHANGES.txt | 3 +++ .../src/java/org/apache/lucene/util/AttributeSource.java | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index cb23cc4df8b..c873b832fdc 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -143,6 +143,9 @@ API Changes: with IndexSearcher when an ExecutorService is specified. (Ryan Ernst, Mike McCandless, Robert Muir) +* LUCENE-5275: Change AttributeSource.toString() to display the current + state of attributes. (Robert Muir) + Optimizations * LUCENE-5225: The ToParentBlockJoinQuery only keeps tracks of the the child diff --git a/lucene/core/src/java/org/apache/lucene/util/AttributeSource.java b/lucene/core/src/java/org/apache/lucene/util/AttributeSource.java index e35ea383dab..30575cc1699 100644 --- a/lucene/core/src/java/org/apache/lucene/util/AttributeSource.java +++ b/lucene/core/src/java/org/apache/lucene/util/AttributeSource.java @@ -501,4 +501,13 @@ public class AttributeSource { } } + /** + * Returns a string consisting of the class's simple name, the hex representation of the identity hash code, + * and the current reflection of all attributes. + * @see #reflectAsString(boolean) + */ + @Override + public String toString() { + return getClass().getSimpleName() + '@' + Integer.toHexString(System.identityHashCode(this)) + " " + reflectAsString(false); + } }