|
I need help understanding how you are expecting I use the
MapELResolver/ResourceBundleELResolver, Adam. First, let me explain what I was doing. I was creating a ValueExpression when I parsed the trinidad-skins.xml and found a value in translation-source. // could be Map or ResourceBundle, so make the type Object return LazyValueExpression.createValueExpression(translationSourceExpression, Object.class); I store this ValueExpression on the skin. Then when getTranslatedValue is called, I would look up the key in the resource cache that I lazily build. A skin can have a bundle-name or it can have a translation-source, then if the translation isn't found, it looks in all the skin additions bundle-name or translation source, and then if it still isn't found it does the same thing for the base skin, on up the chain until it finds it. As I look into a map or resource bundle, I cache the entire map/resource bundle, to make subsequent lookups faster. To get the value from the translation source, I was planning to use the ValueExpression's getValue and then figure out if it is a ResourceBundle instance or a Map instance and proceed from there by caching the Map/ResourceBundle keys/values in mylocale cache, then getting the key's value, etc. --- I don't what you mean when you say I should use a ELResolver. I'm a novice with the ValueExpression, ELResolver code. I'm guessing from reading the javadoc that you mean create an ELContext that has a MapELResolver and another one for ResourceBundleELResolver. Then I figure out what type the ValueExpression is, and then I use that ELContext, and I take the 'key' in getTranslatedValue, and append that to the ValueExpression somehow (or store the _expression_ on the Skin as a String instead of a VE and use that as the 'base') and get the value. I suppose I can cache each key/value as I find it instead of caching the entire contents like I do for the bundle-name code. But I'd rather be consistent. Can you explain to me what you meant and iif/how that is better than the way I was planning to do it? Thanks! Jeanne Simon Lessard wrote: EL implies a small performance overhead but I guess it's acceptable for the gain here. |
- Re: [TRINIDAD] New element in trinidad-skins.xml /SkinImpl/... Gary VanMatre
- Re: [TRINIDAD] New element in trinidad-skins.xml /Skin... Adam Winer
- Re: [TRINIDAD] New element in trinidad-skins.xml /... Simon Lessard
- Re: [TRINIDAD] New element in trinidad-skins.x... Jeanne Waldman
- Re: [TRINIDAD] New element in trinidad-ski... Adam Winer
- Re: [TRINIDAD] New element in trinida... Jeanne Waldman
