jeantil commented on code in PR #1463:
URL: https://github.com/apache/james-project/pull/1463#discussion_r1115678068
##########
server/mailet/rate-limiter/src/main/scala/org/apache/james/transport/mailets/EntityType.scala:
##########
@@ -33,11 +33,15 @@ import scala.util.Try
case class KeyPrefix(value: String)
object ConfigurationOps {
+
+ implicit class OptionOps(mailetConfig: MailetConfig) {
Review Comment:
Why not make a MailetConfigOps with all the extended behavior ? while I am
all for interface segregation this pattern results in translating
```
def getDuration(key: String): Option[Duration] =
Option(mailetConfig.getInitParameter(key))
```
to
```
def getDuration(key: String): Option[Duration] = new
OptionOps(mailetConfig).getOptionalString(key)
```
then
```
val precision: Option[Duration] = getMailetConfig.getDuration("precision")
```
gets translated to
```
val precision: Option[Duration] = new
DurationOps(getMailetConfig).getDuration("precision")
```
this requires 2 different implicit resolutions, 2 instanciations and seems a
bit wasteful
also naming the ops by a part of their return type but not always (see
optionops returns Option[String] Option[Long], DurationOps[] returns
Option[Duration] SizeOps returns Option[Size] so the naming is inconsistent
Using the name of the subject they extend seems more consistent to me
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]