public class

ScriptUtil

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

Class Overview

Utility methods.

Summary

Public Constructors
ScriptUtil()
Public Methods
static String filenameToClassname(String filename)
Determine the main class of a script from the script filename.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ScriptUtil ()

Public Methods

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