
|
If you were logged in you would be able to see more operations.
|
|
|
|
investigate forum post:
The following logic is common ListPropertyAccessor, ArrayPropertyAccessor and ObjectPropertyAccessor. Eg. in ObjectPropertyAccessor's getSourceSetter
conversion = OgnlRuntime.getCompiler().createLocalReference(context,
"((" + wrapClass.getName() + ")ognl.OgnlOps#convertValue($3," + wrapClass.getName()
+ ".class, true))." + OgnlRuntime.getNumericValueGetter(wrapClass),
parm);
It uses
OgnlRuntime.getNumericValueGetter(wrapClass)
which looks like
static {
NUMERIC_VALUES.put(Double.class, "doubleValue()");
NUMERIC_VALUES.put(Float.class, "floatValue()");
NUMERIC_VALUES.put(Integer.class, "intValue()");
NUMERIC_VALUES.put(Long.class, "longValue()");
NUMERIC_VALUES.put(Short.class, "shortValue()");
NUMERIC_VALUES.put(Byte.class, "byteValue()");
NUMERIC_VALUES.put(BigDecimal.class, "doubleValue()");
NUMERIC_VALUES.put(BigInteger.class, "doubleValue()");
NUMERIC_VALUES.put(Boolean.class, "booleanValue()");
}
to return string like eg.
"doubleValue()", "intValue()" etc. to convert the Wrapped object to its primitive types, however it doesn't cover character, so we will get a compilation problem when javassist try to compile the code when we are dealing with character.
Maybe we could define a separate method in OgnlRuntime to deal with all primitive types instead of just numeric values.
Thoughs? Should I open up a jira ticket for this?
Thanks guys
|
|
Description
|
investigate forum post:
The following logic is common ListPropertyAccessor, ArrayPropertyAccessor and ObjectPropertyAccessor. Eg. in ObjectPropertyAccessor's getSourceSetter
conversion = OgnlRuntime.getCompiler().createLocalReference(context,
"((" + wrapClass.getName() + ")ognl.OgnlOps#convertValue($3," + wrapClass.getName()
+ ".class, true))." + OgnlRuntime.getNumericValueGetter(wrapClass),
parm);
It uses
OgnlRuntime.getNumericValueGetter(wrapClass)
which looks like
static {
NUMERIC_VALUES.put(Double.class, "doubleValue()");
NUMERIC_VALUES.put(Float.class, "floatValue()");
NUMERIC_VALUES.put(Integer.class, "intValue()");
NUMERIC_VALUES.put(Long.class, "longValue()");
NUMERIC_VALUES.put(Short.class, "shortValue()");
NUMERIC_VALUES.put(Byte.class, "byteValue()");
NUMERIC_VALUES.put(BigDecimal.class, "doubleValue()");
NUMERIC_VALUES.put(BigInteger.class, "doubleValue()");
NUMERIC_VALUES.put(Boolean.class, "booleanValue()");
}
to return string like eg.
"doubleValue()", "intValue()" etc. to convert the Wrapped object to its primitive types, however it doesn't cover character, so we will get a compilation problem when javassist try to compile the code when we are dealing with character.
Maybe we could define a separate method in OgnlRuntime to deal with all primitive types instead of just numeric values.
Thoughs? Should I open up a jira ticket for this?
Thanks guys |
Show » |
|