Class ScriptUtil

java.lang.Object
com.pnfsoftware.jeb.client.script.ScriptUtil

public class ScriptUtil extends Object
Utility methods.
  • Constructor Details

    • ScriptUtil

      public ScriptUtil()
  • Method Details

    • filenameToClassname

      public static String filenameToClassname(String filename)
      Determine the main class of a script from the script filename. Rules:
      - the leading digits, dashes and underscores are removed from the file name to generate the class name
      - the trailing dashes and underscores are removed from the file name to generate the class name

      Examples:

       Sample.py -> Sample
       _Sample.py -> Sample
       1_Sample.py -> Sample
       2-Sample_.py -> Sample
       a1_Sample.py -> a1_Sample
       Sample_123.py -> Sample_123
       Sample_123__.py -> Sample_123
       111.py -> null (would be empty)
       __1-3 -> null (would be empty)
       __1.3 -> .3
       __1._ -> null (would be . which is not allowed)
       __1..__ -> null (would be .. which is not allowed)
       __1...__ -> ... (not recommended though)
       
      Parameters:
      filename - a simple file name (not a path)
      Returns:
      the expected primary class name (that should be defined inside the script file); on error, the method returns null