All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ch.obermuhlner.scriptengine.java.name.NameStrategy Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
package ch.obermuhlner.scriptengine.java.name;

import javax.script.ScriptException;

public interface NameStrategy {
    String getFullName(String script) throws ScriptException;

    static String extractSimpleName(String fullName) {
        int lastDotIndex = fullName.lastIndexOf(".");
        if (lastDotIndex < 0) {
            return fullName;
        }
        return fullName.substring(lastDotIndex + 1);
    }

    static String extractPackageName(String fullName) {
        int lastDotIndex = fullName.lastIndexOf(".");
        if (lastDotIndex < 0) {
            return "";
        }
        return fullName.substring(0, lastDotIndex);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy