wyona / yanel

http://www.yanel.org
Apache License 2.0
10 stars 5 forks source link

Very small patch for visibility in NodeResource #76

Open baszero opened 8 years ago

baszero commented 8 years ago

important methods should be made protected instead of private so that inheritation becomes easy.

baszero commented 8 years ago

I found a workaround so I don't need get getNode() to be protected.

baszero commented 8 years ago

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:

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.