From a94c12ff9af0f0701d81fc9305d89930d5f2159f Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 7 Mar 2019 18:43:02 +0100 Subject: [PATCH] Polishing --- .../support/AbstractBeanDefinition.java | 22 +++---- .../ImportBeanDefinitionRegistrar.java | 5 +- .../context/annotation/ImportSelector.java | 16 ++--- .../support/AbstractApplicationContext.java | 12 ++-- .../org/springframework/util/ObjectUtils.java | 42 ++++++------- .../AbstractMessageBrokerConfiguration.java | 14 +++-- .../messaging/simp/stomp/StompDecoder.java | 4 +- .../simp/user/MultiServerUserRegistry.java | 14 ++--- .../test/context/TestContext.java | 16 ++--- .../condition/AbstractRequestCondition.java | 61 +++++++++---------- 10 files changed, 103 insertions(+), 103 deletions(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java index 1ce334fbf55..593fc6637d7 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2019 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. @@ -433,7 +433,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess */ @Override public boolean isSingleton() { - return SCOPE_SINGLETON.equals(scope) || SCOPE_DEFAULT.equals(scope); + return SCOPE_SINGLETON.equals(this.scope) || SCOPE_DEFAULT.equals(this.scope); } /** @@ -443,7 +443,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess */ @Override public boolean isPrototype() { - return SCOPE_PROTOTYPE.equals(scope); + return SCOPE_PROTOTYPE.equals(this.scope); } /** @@ -625,7 +625,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess * Return whether this bean has the specified qualifier. */ public boolean hasQualifier(String typeName) { - return this.qualifiers.keySet().contains(typeName); + return this.qualifiers.containsKey(typeName); } /** @@ -778,15 +778,15 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess /** * Return information about methods to be overridden by the IoC * container. This will be empty if there are no method overrides. - * Never returns {@code null}. + *

Never returns {@code null}. */ public MethodOverrides getMethodOverrides() { return this.methodOverrides; } /** - * Set the name of the initializer method. The default is {@code null} - * in which case there is no initializer method. + * Set the name of the initializer method. + *

The default is {@code null} in which case there is no initializer method. */ public void setInitMethodName(String initMethodName) { this.initMethodName = initMethodName; @@ -801,7 +801,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess /** * Specify whether or not the configured init method is the default. - * Default value is {@code false}. + *

The default value is {@code false}. * @see #setInitMethodName */ public void setEnforceInitMethod(boolean enforceInitMethod) { @@ -817,8 +817,8 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess } /** - * Set the name of the destroy method. The default is {@code null} - * in which case there is no destroy method. + * Set the name of the destroy method. + *

The default is {@code null} in which case there is no destroy method. */ public void setDestroyMethodName(String destroyMethodName) { this.destroyMethodName = destroyMethodName; @@ -833,7 +833,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess /** * Specify whether or not the configured destroy method is the default. - * Default value is {@code false}. + *

The default value is {@code false}. * @see #setDestroyMethodName */ public void setEnforceDestroyMethod(boolean enforceDestroyMethod) { diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ImportBeanDefinitionRegistrar.java b/spring-context/src/main/java/org/springframework/context/annotation/ImportBeanDefinitionRegistrar.java index 1dce3d41140..49af978b0d5 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ImportBeanDefinitionRegistrar.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ImportBeanDefinitionRegistrar.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2019 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. @@ -58,7 +58,6 @@ public interface ImportBeanDefinitionRegistrar { * @param importingClassMetadata annotation metadata of the importing class * @param registry current bean definition registry */ - public void registerBeanDefinitions( - AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry); + void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry); } diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ImportSelector.java b/spring-context/src/main/java/org/springframework/context/annotation/ImportSelector.java index c684426f22c..973fca6fed8 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ImportSelector.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ImportSelector.java @@ -20,12 +20,12 @@ import org.springframework.core.type.AnnotationMetadata; /** * Interface to be implemented by types that determine which @{@link Configuration} - * class(es) should be imported based on a given selection criteria, usually one or more - * annotation attributes. + * class(es) should be imported based on a given selection criteria, usually one or + * more annotation attributes. * *

An {@link ImportSelector} may implement any of the following - * {@link org.springframework.beans.factory.Aware Aware} interfaces, and their respective - * methods will be called prior to {@link #selectImports}: + * {@link org.springframework.beans.factory.Aware Aware} interfaces, + * and their respective methods will be called prior to {@link #selectImports}: *

* - *

ImportSelectors are usually processed in the same way as regular {@code @Import} - * annotations, however, it is also possible to defer selection of imports until all - * {@code @Configuration} classes have been processed (see {@link DeferredImportSelector} - * for details). + *

{@code ImportSelector} implementations are usually processed in the same way + * as regular {@code @Import} annotations, however, it is also possible to defer + * selection of imports until all {@code @Configuration} classes have been processed + * (see {@link DeferredImportSelector} for details). * * @author Chris Beams * @since 3.1 diff --git a/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java b/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java index 63752a17da9..a40f66324ab 100644 --- a/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java +++ b/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java @@ -91,24 +91,24 @@ import org.springframework.util.StringValueResolver; * to detect special beans defined in its internal bean factory: * Therefore, this class automatically registers * {@link org.springframework.beans.factory.config.BeanFactoryPostProcessor BeanFactoryPostProcessors}, - * {@link org.springframework.beans.factory.config.BeanPostProcessor BeanPostProcessors} + * {@link org.springframework.beans.factory.config.BeanPostProcessor BeanPostProcessors}, * and {@link org.springframework.context.ApplicationListener ApplicationListeners} * which are defined as beans in the context. * *

A {@link org.springframework.context.MessageSource} may also be supplied * as a bean in the context, with the name "messageSource"; otherwise, message * resolution is delegated to the parent context. Furthermore, a multicaster - * for application events can be supplied as "applicationEventMulticaster" bean + * for application events can be supplied as an "applicationEventMulticaster" bean * of type {@link org.springframework.context.event.ApplicationEventMulticaster} * in the context; otherwise, a default multicaster of type * {@link org.springframework.context.event.SimpleApplicationEventMulticaster} will be used. * - *

Implements resource loading through extending + *

Implements resource loading by extending * {@link org.springframework.core.io.DefaultResourceLoader}. * Consequently treats non-URL resource paths as class path resources * (supporting full class path resource names that include the package path, * e.g. "mypackage/myresource.dat"), unless the {@link #getResourceByPath} - * method is overwritten in a subclass. + * method is overridden in a subclass. * * @author Rod Johnson * @author Juergen Hoeller @@ -381,7 +381,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader else { applicationEvent = new PayloadApplicationEvent(this, event); if (eventType == null) { - eventType = ((PayloadApplicationEvent) applicationEvent).getResolvableType(); + eventType = ((PayloadApplicationEvent) applicationEvent).getResolvableType(); } } @@ -695,7 +695,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader } /** - * Instantiate and invoke all registered BeanPostProcessor beans, + * Instantiate and register all BeanPostProcessor beans, * respecting explicit order if given. *

Must be called before any instantiation of application beans. */ diff --git a/spring-core/src/main/java/org/springframework/util/ObjectUtils.java b/spring-core/src/main/java/org/springframework/util/ObjectUtils.java index 05a4622980c..39e608d44ef 100644 --- a/spring-core/src/main/java/org/springframework/util/ObjectUtils.java +++ b/spring-core/src/main/java/org/springframework/util/ObjectUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. @@ -606,7 +606,7 @@ public abstract class ObjectUtils { /** * Determine the class name for the given object. - *

Returns {@code "null"} if {@code obj} is {@code null}. + *

Returns a {@code "null"} String if {@code obj} is {@code null}. * @param obj the object to introspect (may be {@code null}) * @return the corresponding class name */ @@ -617,7 +617,7 @@ public abstract class ObjectUtils { /** * Return a String representation of the specified Object. *

Builds a String representation of the contents in case of an array. - * Returns {@code "null"} if {@code obj} is {@code null}. + * Returns a {@code "null"} String if {@code obj} is {@code null}. * @param obj the object to build a String representation for * @return a String representation of {@code obj} */ @@ -663,8 +663,8 @@ public abstract class ObjectUtils { * Return a String representation of the contents of the specified array. *

The String representation consists of a list of the array's elements, * enclosed in curly braces ({@code "{}"}). Adjacent elements are separated - * by the characters {@code ", "} (a comma followed by a space). Returns - * {@code "null"} if {@code array} is {@code null}. + * by the characters {@code ", "} (a comma followed by a space). + * Returns a {@code "null"} String if {@code array} is {@code null}. * @param array the array to build a String representation for * @return a String representation of {@code array} */ @@ -694,8 +694,8 @@ public abstract class ObjectUtils { * Return a String representation of the contents of the specified array. *

The String representation consists of a list of the array's elements, * enclosed in curly braces ({@code "{}"}). Adjacent elements are separated - * by the characters {@code ", "} (a comma followed by a space). Returns - * {@code "null"} if {@code array} is {@code null}. + * by the characters {@code ", "} (a comma followed by a space). + * Returns a {@code "null"} String if {@code array} is {@code null}. * @param array the array to build a String representation for * @return a String representation of {@code array} */ @@ -726,8 +726,8 @@ public abstract class ObjectUtils { * Return a String representation of the contents of the specified array. *

The String representation consists of a list of the array's elements, * enclosed in curly braces ({@code "{}"}). Adjacent elements are separated - * by the characters {@code ", "} (a comma followed by a space). Returns - * {@code "null"} if {@code array} is {@code null}. + * by the characters {@code ", "} (a comma followed by a space). + * Returns a {@code "null"} String if {@code array} is {@code null}. * @param array the array to build a String representation for * @return a String representation of {@code array} */ @@ -757,8 +757,8 @@ public abstract class ObjectUtils { * Return a String representation of the contents of the specified array. *

The String representation consists of a list of the array's elements, * enclosed in curly braces ({@code "{}"}). Adjacent elements are separated - * by the characters {@code ", "} (a comma followed by a space). Returns - * {@code "null"} if {@code array} is {@code null}. + * by the characters {@code ", "} (a comma followed by a space). + * Returns a {@code "null"} String if {@code array} is {@code null}. * @param array the array to build a String representation for * @return a String representation of {@code array} */ @@ -788,8 +788,8 @@ public abstract class ObjectUtils { * Return a String representation of the contents of the specified array. *

The String representation consists of a list of the array's elements, * enclosed in curly braces ({@code "{}"}). Adjacent elements are separated - * by the characters {@code ", "} (a comma followed by a space). Returns - * {@code "null"} if {@code array} is {@code null}. + * by the characters {@code ", "} (a comma followed by a space). + * Returns a {@code "null"} String if {@code array} is {@code null}. * @param array the array to build a String representation for * @return a String representation of {@code array} */ @@ -820,8 +820,8 @@ public abstract class ObjectUtils { * Return a String representation of the contents of the specified array. *

The String representation consists of a list of the array's elements, * enclosed in curly braces ({@code "{}"}). Adjacent elements are separated - * by the characters {@code ", "} (a comma followed by a space). Returns - * {@code "null"} if {@code array} is {@code null}. + * by the characters {@code ", "} (a comma followed by a space). + * Returns a {@code "null"} String if {@code array} is {@code null}. * @param array the array to build a String representation for * @return a String representation of {@code array} */ @@ -852,8 +852,8 @@ public abstract class ObjectUtils { * Return a String representation of the contents of the specified array. *

The String representation consists of a list of the array's elements, * enclosed in curly braces ({@code "{}"}). Adjacent elements are separated - * by the characters {@code ", "} (a comma followed by a space). Returns - * {@code "null"} if {@code array} is {@code null}. + * by the characters {@code ", "} (a comma followed by a space). + * Returns a {@code "null"} String if {@code array} is {@code null}. * @param array the array to build a String representation for * @return a String representation of {@code array} */ @@ -883,8 +883,8 @@ public abstract class ObjectUtils { * Return a String representation of the contents of the specified array. *

The String representation consists of a list of the array's elements, * enclosed in curly braces ({@code "{}"}). Adjacent elements are separated - * by the characters {@code ", "} (a comma followed by a space). Returns - * {@code "null"} if {@code array} is {@code null}. + * by the characters {@code ", "} (a comma followed by a space). + * Returns a {@code "null"} String if {@code array} is {@code null}. * @param array the array to build a String representation for * @return a String representation of {@code array} */ @@ -914,8 +914,8 @@ public abstract class ObjectUtils { * Return a String representation of the contents of the specified array. *

The String representation consists of a list of the array's elements, * enclosed in curly braces ({@code "{}"}). Adjacent elements are separated - * by the characters {@code ", "} (a comma followed by a space). Returns - * {@code "null"} if {@code array} is {@code null}. + * by the characters {@code ", "} (a comma followed by a space). + * Returns a {@code "null"} String if {@code array} is {@code null}. * @param array the array to build a String representation for * @return a String representation of {@code array} */ diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java index b81c1823d33..9ef7a78e263 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/config/AbstractMessageBrokerConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2019 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. @@ -65,18 +65,20 @@ import org.springframework.validation.Validator; * protocols such as STOMP. * *

{@link #clientInboundChannel()} and {@link #clientOutboundChannel()} deliver - * messages to and from remote clients to several message handlers such as + * messages to and from remote clients to several message handlers such as the + * following. *

    *
  • {@link #simpAnnotationMethodMessageHandler()}
  • *
  • {@link #simpleBrokerMessageHandler()}
  • *
  • {@link #stompBrokerRelayMessageHandler()}
  • *
  • {@link #userDestinationMessageHandler()}
  • *
- * while {@link #brokerChannel()} delivers messages from within the application to the + * + *

{@link #brokerChannel()} delivers messages from within the application to the * the respective message handlers. {@link #brokerMessagingTemplate()} can be injected * into any application component to send messages. * - *

Subclasses are responsible for the part of the configuration that feed messages + *

Subclasses are responsible for the parts of the configuration that feed messages * to and from the client inbound/outbound channels (e.g. STOMP over WebSocket). * * @author Rossen Stoyanchev @@ -387,7 +389,7 @@ public abstract class AbstractMessageBrokerConfiguration implements ApplicationC * Override this method to add custom message converters. * @param messageConverters the list to add converters to, initially empty * @return {@code true} if default message converters should be added to list, - * {@code false} if no more converters should be added. + * {@code false} if no more converters should be added */ protected boolean configureMessageConverters(List messageConverters) { return true; @@ -410,7 +412,7 @@ public abstract class AbstractMessageBrokerConfiguration implements ApplicationC } /** - * Create the user registry that provides access to the local users. + * Create the user registry that provides access to local users. */ protected abstract SimpUserRegistry createLocalUserRegistry(); diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompDecoder.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompDecoder.java index d4700498f3a..bdd0e14f490 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompDecoder.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2019 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. @@ -258,7 +258,7 @@ public class StompDecoder { if (index + 1 >= inString.length()) { throw new StompConversionException("Illegal escape sequence at index " + index + ": " + inString); } - Character c = inString.charAt(index + 1); + char c = inString.charAt(index + 1); if (c == 'r') { sb.append('\r'); } diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/user/MultiServerUserRegistry.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/user/MultiServerUserRegistry.java index f155ec70f1d..efe489fca95 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/user/MultiServerUserRegistry.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/user/MultiServerUserRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2019 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. @@ -63,7 +63,7 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati * Create an instance wrapping the local user registry. */ public MultiServerUserRegistry(SimpUserRegistry localRegistry) { - Assert.notNull(localRegistry, "'localRegistry' is required."); + Assert.notNull(localRegistry, "'localRegistry' is required"); this.id = generateId(); this.localRegistry = localRegistry; this.delegateApplicationEvents = this.localRegistry instanceof SmartApplicationListener; @@ -274,10 +274,10 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati private String name; - /* User sessions from "this" registry only (i.e. one server) */ + // User sessions from "this" registry only (i.e. one server) private Set sessions; - /* Cross-server session lookup (e.g. user connected to multiple servers) */ + // Cross-server session lookup (e.g. user connected to multiple servers) private SessionLookup sessionLookup; /** @@ -518,13 +518,13 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati return false; } SimpSubscription otherSubscription = (SimpSubscription) other; - return (ObjectUtils.nullSafeEquals(getSession(), otherSubscription.getSession()) && - this.id.equals(otherSubscription.getId())); + return (getId().equals(otherSubscription.getId()) && + ObjectUtils.nullSafeEquals(getSession(), otherSubscription.getSession())); } @Override public int hashCode() { - return this.id.hashCode() * 31 + ObjectUtils.nullSafeHashCode(getSession()); + return getId().hashCode() * 31 + ObjectUtils.nullSafeHashCode(getSession()); } @Override diff --git a/spring-test/src/main/java/org/springframework/test/context/TestContext.java b/spring-test/src/main/java/org/springframework/test/context/TestContext.java index cd8df7ab5ce..385b324182a 100644 --- a/spring-test/src/main/java/org/springframework/test/context/TestContext.java +++ b/spring-test/src/main/java/org/springframework/test/context/TestContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2019 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. @@ -29,6 +29,8 @@ import org.springframework.test.annotation.DirtiesContext.HierarchyMode; * * @author Sam Brannen * @since 2.5 + * @see TestContextManager + * @see TestExecutionListener */ public interface TestContext extends AttributeAccessor, Serializable { @@ -38,7 +40,7 @@ public interface TestContext extends AttributeAccessor, Serializable { *

Implementations of this method are responsible for loading the * application context if the corresponding context has not already been * loaded, potentially caching the context as well. - * @return the application context + * @return the application context (never {@code null}) * @throws IllegalStateException if an error occurs while retrieving the * application context */ @@ -70,8 +72,7 @@ public interface TestContext extends AttributeAccessor, Serializable { * Get the {@linkplain Throwable exception} that was thrown during execution * of the {@linkplain #getTestMethod() test method}. *

Note: this is a mutable property. - * @return the exception that was thrown, or {@code null} if no - * exception was thrown + * @return the exception that was thrown, or {@code null} if no exception was thrown * @see #updateState(Object, Method, Throwable) */ Throwable getTestException(); @@ -89,14 +90,13 @@ public interface TestContext extends AttributeAccessor, Serializable { void markApplicationContextDirty(HierarchyMode hierarchyMode); /** - * Update this test context to reflect the state of the currently executing - * test. + * Update this test context to reflect the state of the currently executing test. *

Caution: concurrent invocations of this method might not be thread-safe, * depending on the underlying implementation. * @param testInstance the current test instance (may be {@code null}) * @param testMethod the current test method (may be {@code null}) - * @param testException the exception that was thrown in the test method, or - * {@code null} if no exception was thrown + * @param testException the exception that was thrown in the test method, + * or {@code null} if no exception was thrown */ void updateState(Object testInstance, Method testMethod, Throwable testException); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractRequestCondition.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractRequestCondition.java index 26fb5641cfe..1c1ba726714 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractRequestCondition.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractRequestCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2019 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. @@ -28,16 +28,39 @@ import java.util.Iterator; */ public abstract class AbstractRequestCondition> implements RequestCondition { + /** + * Indicates whether this condition is empty, i.e. whether or not it + * contains any discrete items. + * @return {@code true} if empty; {@code false} otherwise + */ + public boolean isEmpty() { + return getContent().isEmpty(); + } + + /** + * Return the discrete items a request condition is composed of. + *

For example URL patterns, HTTP request methods, param expressions, etc. + * @return a collection of objects (never {@code null}) + */ + protected abstract Collection getContent(); + + /** + * The notation to use when printing discrete items of content. + *

For example {@code " || "} for URL patterns or {@code " && "} + * for param expressions. + */ + protected abstract String getToStringInfix(); + + @Override - public boolean equals(Object obj) { - if (this == obj) { + public boolean equals(Object other) { + if (this == other) { return true; } - if (obj != null && getClass() == obj.getClass()) { - AbstractRequestCondition other = (AbstractRequestCondition) obj; - return getContent().equals(other.getContent()); + if (other == null || getClass() != other.getClass()) { + return false; } - return false; + return getContent().equals(((AbstractRequestCondition) other).getContent()); } @Override @@ -59,28 +82,4 @@ public abstract class AbstractRequestConditionFor example URL patterns, HTTP request methods, param expressions, etc. - * @return a collection of objects, never {@code null} - */ - protected abstract Collection getContent(); - - /** - * The notation to use when printing discrete items of content. - *

For example {@code " || "} for URL patterns or {@code " && "} - * for param expressions. - */ - protected abstract String getToStringInfix(); - }