ppkarwasz commented on code in PR #784:
URL: https://github.com/apache/commons-io/pull/784#discussion_r2368889461
##########
src/main/java/org/apache/commons/io/build/AbstractOriginSupplier.java:
##########
@@ -368,4 +376,26 @@ public B setURI(final URI origin) {
public B setWriter(final Writer origin) {
return setOrigin(newWriterOrigin(origin));
}
+
+ /**
+ * Sets a new origin.
+ *
+ * @param origin the new origin.
+ * @return {@code this} instance.
+ * @since 2.21.0
+ */
+ public B setReadableByteChannel(final ReadableByteChannel origin) {
+ return setOrigin(newChannelOrigin(origin));
+ }
+
+ /**
+ * Sets a new origin.
+ *
+ * @param origin the new origin.
+ * @return {@code this} instance.
+ * @since 2.21.0
+ */
+ public B setWritableByteChannel(final WritableByteChannel origin) {
Review Comment:
You make a good point. Since there are quite a few `Channel` sub-interfaces,
how about introducing a single generic accessor on `AbstractOrigin` instead of
separate getters? For example:
```java
public <T extends Channel> T getChannel(Class<T> type);
```
Each implementation could then attempt to provide the requested type or fail
fast if it can’t.
On the builder side we can keep it simple with a single setter:
```java
public B setChannel(Channel channel);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]