Ah, I missed ContextDataFactory. That's useful. Yes, I was creating my own impl of StringMap in Scala, which was a bit tricky due to the way it uses generics. But I managed to do it.
Scala uses generics similarly to Java, but there are some subtle differences. On Fri, Oct 21, 2016 at 1:53 AM, Remko Popma <[email protected]> wrote: > To get a StringMap instance, use this factory: https://github.com/ > apache/logging-log4j2/blob/master/log4j-core/src/main/ > java/org/apache/logging/log4j/core/impl/ContextDataFactory.java > > About the use of generics: it makes things slightly harder if you want to > create your own implementation of StringMap, is that your intention? If > you're just using the interface you should be able to use Object anywhere > for generic arguments or return types. Is this hard in Scala? > > Remko > > > Sent from my iPhone > > On 20 Oct 2016, at 21:46, Mikael Ståldal <[email protected]> > wrote: > > I am also not at all happy with the fact that the getValue and forEach > methods in StringMap are generic, that makes it tricky to implement in > Scala. I think they should use Object as type of the value. > > On Thu, Oct 20, 2016 at 2:18 PM, Mikael Ståldal <[email protected] > > wrote: > >> I am now trying to implement a custom ContextDataInjector. >> >> This is a bit tricky since there is no implementation of StringMap >> available for public use. I would like to use SortedArrayStringMap, but >> it is marked with "*Consider this class private*". >> >> How am I supposed to do? >> >> -- >> [image: MagineTV] >> >> *Mikael Ståldal* >> Senior software developer >> >> *Magine TV* >> [email protected] >> Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com >> >> Privileged and/or Confidential Information may be contained in this >> message. If you are not the addressee indicated in this message >> (or responsible for delivery of the message to such a person), you may >> not copy or deliver this message to anyone. In such case, >> you should destroy this message and kindly notify the sender by reply >> email. >> > > > > -- > [image: MagineTV] > > *Mikael Ståldal* > Senior software developer > > *Magine TV* > [email protected] > Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com > > Privileged and/or Confidential Information may be contained in this > message. If you are not the addressee indicated in this message > (or responsible for delivery of the message to such a person), you may not > copy or deliver this message to anyone. In such case, > you should destroy this message and kindly notify the sender by reply > email. > > -- [image: MagineTV] *Mikael Ståldal* Senior software developer *Magine TV* [email protected] Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email.
