Open baszero opened 8 years ago
I found a workaround so I don't need get getNode()
to be protected.
I reopened this pull request as I really think that making those two methods protected
makes fully sense and is really required.
Use Case / Reason:
<img src="/static/1.jpg"/>
getRepoPath()
where you do the URL to Yarep-Path translation.Example of overridden method in subclassed NodeResource class:
protected String getRepositoryPath() throws Exception {
String pathPrefix = getResourceConfigProperty("path-prefix");
String path = getPath();
if (pathPrefix == null) {
return path;
}
int index = path.indexOf(pathPrefix);
if (index != 0) {
throw new IllegalArgumentException("Path <"+path+"> should start with <"+pathPrefix+">!");
}
String repositoryPath = path.substring(index + pathPrefix.length());
return repositoryPath;
}
Today you can not reuse the NodeResource and just override the getRepositoryPath() method because it is private.
I think that both getNode() and getRepoPath() should be made protected.
important methods should be made
protected
instead ofprivate
so that inheritation becomes easy.