public static String mapSourcePath()

in src/main/java/org/apache/sling/scripting/java/impl/CompilerUtil.java [26:49]


    public static String mapSourcePath(final String path) {
        final String str;
        if ( path.endsWith(".java") ) {
            str = path.substring(0, path.length() - 5);
        } else {
            str = path;
        }
        final StringBuilder sb = new StringBuilder();
        int pos = 0;
        int start = 0;
        while ( pos < str.length() ) {
            final char c = str.charAt(pos);
            if ( c == '/' ) {
                if ( start != pos ) {
                    sb.append(makeJavaIdentifier(str.substring(start, pos)));
                }
                sb.append(c);
                start = pos + 1;
            }
            pos++;
        }
        sb.append(makeJavaIdentifier(str.substring(start)));
        return sb.toString();
    }