public ProvidedScriptCapability build()

in src/main/java/org/apache/sling/scriptingbundle/plugin/capability/ProvidedScriptCapability.java [87:99]


        public ProvidedScriptCapability build() {
            int lastDotIndex = path.lastIndexOf('.');
            if (lastDotIndex == -1 || lastDotIndex == path.length() - 1) {
                throw new IllegalStateException(String.format("Path %s does not seem to have an extension.", path));
            }
            String extension = path.substring(lastDotIndex + 1);
            String scriptEngine = scriptEngineMappings.get(extension);
            if (StringUtils.isEmpty(scriptEngine)) {
                throw new IllegalStateException(String.format("Path %s does not seem to have an extension mapped to a script engine.",
                        path));
            }
            return new ProvidedScriptCapability(path, extension, scriptEngine);
        }