Hello all!
I am aware that UIMA-FIT is capable of initializing enum-typed configuration parameters from a string equal to the name of one of the values in an enum class.
i.e. this works as documented:
public static enum SomeEnum {
A_VALUE;
}
@ConfigurationParameter( name = "example", mandatory = false, defaultValue="A_VALUE" )
private SomeEnum enumValue;
However, I recently had to refactor one of the enums I was using into a normal class with static members, and I found that UIMA-FIT is equally capable of initializing these parameter values from a string equal to the name given in the class definition to a static instance... i.e. this also works:
public static class SomeClass {
public static final SomeClass A_VALUE = new SomeClass()
}
@ConfigurationParameter( name = "example", mandatory = false, defaultValue="A_VALUE" )
private SomeClass enumValue;
Is this known behaviour? I tried stepping through the conf param initialization logic, but I got lost in the depths of Spring, and I get the feeling that this is basically a side-effect of spring's implementation of enum initialization details, which seem a little unreliable. then again, enum types are basically fixed-valued classes with static instances, no?
I have attached a working example of what I mean if my explanation above doesn't make sense.
Any comments would be welcome, I'm very curious to know why this works and whether it is reliable enough to be used in production...
Thanks!
jta
sent from a phone. please excuse terseness and tpyos.
enviado desde un teléfono. por favor disculpe la parquedad y los erroers.