Re: StringMap implementation for implementors of custom ContextDataInjector

2016-10-21 Thread Mikael Ståldal
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, R

Re: StringMap implementation for implementors of custom ContextDataInjector

2016-10-20 Thread Remko Popma
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 Stri

Re: StringMap implementation for implementors of custom ContextDataInjector

2016-10-20 Thread Gary Gregory
On Thu, Oct 20, 2016 at 10:26 AM, Mikael Ståldal wrote: > Yes, ReadOnlyStringMap. I don't think we should avoid generics, just use > them in a proper and safe way. In a way which does not require > @SuppressWarnings("unchecked"). > WRT, @SuppressWarnings("unchecked"). that is a pipe dream IMO. I

Re: StringMap implementation for implementors of custom ContextDataInjector

2016-10-20 Thread Mikael Ståldal
Yes, ReadOnlyStringMap. I don't think we should avoid generics, just use them in a proper and safe way. In a way which does not require @SuppressWarnings("unchecked"). On Thu, Oct 20, 2016 at 6:47 PM, Gary Gregory wrote: > On Thu, Oct 20, 2016 at 5:46 AM, Mikael Ståldal > wrote: > >> I am also

Re: StringMap implementation for implementors of custom ContextDataInjector

2016-10-20 Thread Gary Gregory
On Thu, Oct 20, 2016 at 5:46 AM, Mikael Ståldal 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. > You must mean ReadOnlyStringMap

Re: StringMap implementation for implementors of custom ContextDataInjector

2016-10-20 Thread Mikael Ståldal
I raised that issue before, even though I did not know about the Scala issue then: https://issues.apache.org/jira/browse/LOG4J2-1447?focusedCommentId=15395455&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15395455 On Thu, Oct 20, 2016 at 2:46 PM, Mikael Ståldal wro

Re: StringMap implementation for implementors of custom ContextDataInjector

2016-10-20 Thread Mikael Ståldal
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 wrote: > I am now trying to implement a custom

StringMap implementation for implementors of custom ContextDataInjector

2016-10-20 Thread Mikael Ståldal
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]