0

I am currently working on a customized behavior of how Jasper retrieves values from resource bundle object. As I know, I can pass a resource bundle as REPORT_RESOURCE_BUNDLE and $R{SOME_TEXT} in the report will be replaced as the value of resource bundle.

What I wanna do is doing a customized getString() methods that works like follow:

public String getString(){
    if (map.get("SOME_KEY_A")!=null){
        return map.get("SOME_KEY_A");
    }else{
        return map.get("SOME_KEY");
    }
}

SOME_KEY_A is a specific value, if it is not defined, bundle will return text associates with SOME_KEY (the default value).

I have tried to override getString() or getObject() but they are final and we cannot override it. Both methods of ResourceBundle are calling handleGetObject(), however, adding the above logic to this methods doesn't change the behavior of Jasper report.

Anyone know which method Jasper will be calling to get the localized text? Thanks!

4

0 回答 0