5353 * delegate method's answer and returns whatever
5454 * {@link #interceptAnswer(Object)} returned.</li>
5555 * </ul>
56- * </ p>
56+ * <p>
5757 * If you are writing a Jenkins plugin that needs a class to implement/wrap
5858 * {@link DockerClient}, you'd be best advised to extend this one, otherwise
59- * your code could fail whenever the version of this plugin changes.
59+ * your code could fail whenever the version of this plugin changes and the
60+ * {@link DockerClient} gains additional methods.
6061 */
6162@ SuppressWarnings ("deprecation" )
6263public class DelegatingDockerClient implements DockerClient {
@@ -75,7 +76,8 @@ public DelegatingDockerClient(@Nonnull DockerClient delegate) {
7576
7677 /**
7778 * Obtains the underlying {@link DockerClient} interface. Subclasses can
78- * override this if they need to hook into every call.
79+ * override this if they need to hook into every call before anything else
80+ * happens.
7981 *
8082 * @return the {@link DockerClient} to be delegated to.
8183 */
@@ -85,10 +87,18 @@ protected DockerClient getDelegate() {
8587 }
8688
8789 /**
88- * Called just before the result is returned. Allows a subclass to act just
89- * before the method returns and/or to alter the result.
90+ * Called just before the result is returned. Subclasses can override this if
91+ * they need to hook into every call just before the method returns and/or to
92+ * alter the result.
93+ * <p>
94+ * Note: If a subclass only wishes to act upon certain specific
95+ * {@link DockerClient} calls then it may be clearer to override those specific
96+ * methods instead. This hook is intended for use by subclasses that need to act
97+ * upon "all methods" or need to act on methods that were not part of the
98+ * {@link DockerClient} API at the time they were implemented.
9099 *
91100 * @param originalAnswer The result from the delegate.
101+ * @param <T> The type of the <code>originalAnswer</code>.
92102 * @return The result to be returned instead.
93103 */
94104 protected <T > T interceptAnswer (T originalAnswer ) {
@@ -98,6 +108,12 @@ protected <T> T interceptAnswer(T originalAnswer) {
98108 /**
99109 * Called just before the method returns void. Allows a subclass to act just
100110 * before the method returns.
111+ * <p>
112+ * Note: If a subclass only wishes to act upon certain specific
113+ * {@link DockerClient} calls then it may be clearer to override those specific
114+ * methods instead. This hook is intended for use by subclasses that need to act
115+ * upon "all methods" or need to act on methods that were not part of the
116+ * {@link DockerClient} API at the time they were implemented.
101117 */
102118 protected void interceptVoid () {
103119 }
0 commit comments