Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Trivial
-
Resolution: Fixed
-
Affects Version/s: Release 1.4.1
-
Fix Version/s: Release 1.4.2
-
Component/s: Tag Library
-
Labels:None
Description
Currently the options-enumeration tag supports enums in a single-level inner class to be specified using dots ('.') only without dollars ('$'). (Refer to STS-253)
So in the following, enum="xxx.enums.Outer.LevelOne" works, but enum="xxx.enums.Outer.Inner.LevelTwo" does not. The latter enum can still be specified as "xxx.enums.Outer$Inner$LevelTwo", which looks ugly.
It will be better if the tag allows any number of dollars to be specified as dots.
package xxx.enums;
public class Outer {
public static enum LevelOne { ONE, TWO }
public static class Inner {
public static enum LevelTwo { THREE, FOUR }
}
}
One strategy would be to keep replacing the last (rightmost) dot with a dollar until ReflectUtil.findClass works or until there are no more dots (at which point, the original exception should be thrown). This code can be placed in a utility class (ReflectUtil.findClass itself looks good) and reused in case there are inner ActionBean classes to be specified in other tags (form, link, url, useActionBean) ![]()