This is an automated email from the ASF dual-hosted git repository. mattsicker pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit 338ee7286770b859b457546c8daf07aa2a45044c Author: Matt Sicker <[email protected]> AuthorDate: Sat Jul 23 16:30:11 2022 -0500 Add javadoc Signed-off-by: Matt Sicker <[email protected]> --- .../java/org/apache/logging/log4j/plugins/di/BindingMap.java | 3 +++ .../main/java/org/apache/logging/log4j/plugins/di/Key.java | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/di/BindingMap.java b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/di/BindingMap.java index 0439de85c7..e52beb6575 100644 --- a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/di/BindingMap.java +++ b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/di/BindingMap.java @@ -56,6 +56,9 @@ class BindingMap { bindings.put(key, Binding.bind(key, factory)); } + /** + * @see org.apache.logging.log4j.plugins.util.OrderedComparator + */ public <T> Supplier<T> merge(final Key<T> key, final Supplier<T> factory) { final Binding<?> newBinding = bindings.merge(key, Binding.bind(key, factory), (oldBinding, binding) -> oldBinding.getKey().getOrder() <= binding.getKey().getOrder() ? oldBinding : binding); diff --git a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/di/Key.java b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/di/Key.java index b060376424..b85658af16 100644 --- a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/di/Key.java +++ b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/di/Key.java @@ -102,6 +102,10 @@ public class Key<T> { return namespace; } + /** + * Returns the ordinal value of this key. Keys that are otherwise equal can be compared by this + * ordinal using the natural integer comparator. + */ public final int getOrder() { return order; } @@ -113,6 +117,9 @@ public class Key<T> { return new Key<>(type, rawType, qualifierType, name, namespace, order); } + /** + * Returns a new key using the provided namespace otherwise populated with the same values as this instance. + */ public final Key<T> withNamespace(final String namespace) { return new Key<>(type, rawType, qualifierType, name, namespace, order); } @@ -136,6 +143,10 @@ public class Key<T> { return null; } + /** + * If this key's type {@code T} is a parameterized type, then this returns a new key corresponding to the + * requested parameterized type argument along with the same remaining values as this key. + */ public final <P> Key<P> getParameterizedTypeArgument(final int arg) { if (type instanceof ParameterizedType) { return forQualifiedNamedType(qualifierType, name, ((ParameterizedType) type).getActualTypeArguments()[arg],
