Hi,
I just wanted to decorate JcrResourceResolver in order to extend the
search-path.
However, the fact that JcrResourceResolver doesn't call it's own method
getSearchPath, but factory.getSearchPath, forces me not just to decorate
getSearchPath, but also getResource.
That behaviour is kind of weird for my cases' point of view. There's a
comment though indicating, that this.getSearchPath should not be called,
in order to save a few cycles.
getResource:
// (don't use this.getSearchPath() to save a few cycle for not cloning)
for (String prefix : factory.getSearchPath()) {
The method getSearchPath of JcrResourceResolver clones the result of
factory.getSearchPath.
public String[] getSearchPath() {
return factory.getSearchPath().clone();
}
It saves few cycles not to clone the result, but is just not very
convenient from my point of view.
I'd propose to change the implementation in the following way:
getResource:
for(String prefix:getSearchPathInternal()){
public String[] getSearchPath(){
return getSearchPathInternal().clone();
}
protected String[] getSearchPathInternal(){
return factory.getSearchPath();
}
That way, I could just decorate the internal method, the defensive copy
would reside for public usage and there would be just one additional
method-call.
Greetings,
Thomas Praxl
Software Engineer
--------------------------------------------------
namics (deutschland) gmbh - a PubliGroupe company
Gutleutstrasse 96
D-60329 Frankfurt am Main
T +49 (0) 69 36 50 59 263
http://www.namics.com, http://blog.namics.com
mailto: [email protected]
--------------------------------------------------
Handelsregister B des Amtsgerichts Frankfurt a.M.
Reg.-Nr. HRB 57721 / Sitz: Frankfurt a.M.
Geschäftsführerin: Elke Schreckenbach
?????????????????????????????????-
> Europäisches Accessibility Forum
27.03.09 in Frankfurt am Main
http://www.namics.com/accessibility_mm
> Referat: JAX '09 20.-24.04.09 in Mainz
Buildsysteme: Welches hätten Sie denn gerne? Markus Stäuble, namics
(deutschland) gmbh
http://it-republik.de/jaxenter/jax/sessions/?tid=1054#session-7
> E-Commerce Conference in München
30.04.09 Conversion Rate Optimization, Eva Johannis, namics (deutschland)
gmbh
http://www.namics.com/events-wissen/daten-events/e-commerce-conference.html