I found out that PropertyEditorManager
registers/finds editors per ThreadGroupContext
basis, not per global registry as prior to Java7.
And Java7 every time creates a new ThreadGroupContext for a new ThreadGroup
. Thus PropertyEditorFinder (which actually registers/finds editors) is again new.
Java uses predefined editors for some classes (Byte
, Long
, etc) and registers them in PropertyEditorFinder
at ctor
). Let's say I want to register my own PropertyEditor
for some predefined class (i.e. Long). It's easy to do in Java6, but in Java7, each time threads are created within new ThreadGroup
I lost my editor.
So could you please tell me is there any solution to handle in a nice manner which editors are created for a new ThreadGroup
in Java7? If face some issue and how do you overcome it?
P.S. I guess I should apologize for my English =)
P.P.S. ThreadGroupContext
is a replacement for AppContext
. And I was hoping that implementation of creating contexts would be similar: both use mapping between ThreadGroup
to context (AppContext
in java 6, ThreadGroupContext
in java 7). And java 6 uses the same AppContext
for new ThreadGroup
as for its parent. In other words AppContext
is used for the whole ThreadGroup
tree in a jvm. But unfortunately creating of ThreadGroupContext
is different - it is simply a new context for a new group. So the question is automatically resolved if one day ThreadGroupContext
will use the same creating technique.
If you had a class with a FQPN of java.lang.Long, you just need to implement a class called java.lang.LongEditor and distribute it with your application. In general, just implement a class that has the name of the class you want to edit with Editor appended to the end of it, and Java should find it automatically
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With