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
```
implicit class DurationOps(mailetConfig: MailetConfig) {
def getDuration(key: String): Option[Duration] =
Option(mailetConfig.getInitParameter(key)) def getDuration(key:
String): Option[Duration] = new OptionOps(mailetConfig).getOptionalString(key)
.map(string => DurationParser.parse(string, ChronoUnit.SECONDS))
.map(string => DurationParser.parse(string, ChronoUnit.SECONDS))
} }
```
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
--
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]