Repository: logging-log4j2 Updated Branches: refs/heads/master 6bc03e7e8 -> e31adf7a6
[LOG4J2-1065] Define org.apache.logging.log4j.Marker.equals(Object) and org.apache.logging.log4j.Marker.hashCode(). Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/e31adf7a Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/e31adf7a Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/e31adf7a Branch: refs/heads/master Commit: e31adf7a648d7cefe4ecd8a8065d011a4eb7c42f Parents: 6bc03e7 Author: ggregory <[email protected]> Authored: Mon Jun 22 11:36:08 2015 -0700 Committer: ggregory <[email protected]> Committed: Mon Jun 22 11:36:08 2015 -0700 ---------------------------------------------------------------------- .../java/org/apache/logging/log4j/Marker.java | 19 ++++++++++++++++++- src/changes/changes.xml | 3 +++ 2 files changed, 21 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e31adf7a/log4j-api/src/main/java/org/apache/logging/log4j/Marker.java ---------------------------------------------------------------------- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/Marker.java b/log4j-api/src/main/java/org/apache/logging/log4j/Marker.java index 919630f..41f9e91 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/Marker.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/Marker.java @@ -27,7 +27,7 @@ import java.io.Serializable; */ public interface Marker extends Serializable { - /** + /** * Adds a Marker as a parent to this Marker. * @param markers The parent markers to add. * @return The current Marker object, thus allowing multiple adds to be concatenated. @@ -36,6 +36,15 @@ public interface Marker extends Serializable { Marker addParents(Marker... markers); /** + * Returns true if the given marker has the same name as this marker. + * + * @param obj the reference object with which to compare. + * @return true if the given marker has the same name as this marker. + * @since 2.4 + */ + public boolean equals(Object obj); + + /** * Returns the name of this Marker. * @return The name of the Marker. */ @@ -48,6 +57,14 @@ public interface Marker extends Serializable { Marker[] getParents(); /** + * Returns a hash code value based on the name of this marker. + * Markers are equal if they have the same name. + * @return the computed hash code + * @since 2.4 + */ + public int hashCode(); + + /** * Indicates whether this Marker has references to any other Markers. * @return {@code true} if the Marker has parent Markers */ http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/e31adf7a/src/changes/changes.xml ---------------------------------------------------------------------- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index eb50bce..fb305c6 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -99,6 +99,9 @@ <action issue="LOG4J2-1062" dev="ggregory" type="fix"> Log4jMarker#add(Marker) does not respect org.slf4j.Marker contract. </action> + <action issue="LOG4J2-1065" dev="ggregory" type="update"> + Define org.apache.logging.log4j.Marker.equals(Object) and org.apache.logging.log4j.Marker.hashCode(). + </action> <action issue="LOG4J2-1063" dev="ggregory" type="update"> Avoid creating temporary array object in org.apache.logging.slf4j.Log4jMarker.iterator(). </action>
