Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
Nightly Builds
-
None
-
None
-
Operating System: All
Platform: All
-
13108
Description
Hello,
I think that in BeanPropertyPointer.java there is an unnecessary use of
reflection.
If you get a member of a collection then the collection will be
fetched twice through reflection.
The SimplePathInterpreter.java has the following code :
if (index >= 0 && index < pointer.getLength())
{ pointer.setIndex(index); return pointer.getValuePointer(); }The pointer.getLength() will set the 'baseValue' in BeanPropertyPointer.
The pointer.getValuePointer() will wet the 'value' in BeanPropertyPointer.
Both will do reflection.
getValuePointer() calls getNode().
getNodeValue() doesn't use the 'baseValue' and I think it can !
So I changed getNode() into :
public Object getNode(){
if (value == UNINITIALIZED){
PropertyDescriptor pd = getPropertyDescriptor();
if (pd == null)
else {
getBaseValue();
if(baseValue != null) {
if (index == WHOLE_COLLECTION)
else if (index >= 0 && index < getLength())
{ value = ValueUtils.getValue(baseValue, index); } }
}
}
return value;
}
Kees.