Class DefaultNameStrategy

java.lang.Object
ch.obermuhlner.scriptengine.java.name.DefaultNameStrategy
All Implemented Interfaces:
NameStrategy

public class DefaultNameStrategy extends Object implements NameStrategy
A NameStrategy that scans the Java script to determine the package name and class name defined in the script.
  • Field Details

    • NAME_PATTERN

      private static final Pattern NAME_PATTERN
    • PACKAGE_PATTERN

      private static final Pattern PACKAGE_PATTERN
  • Constructor Details

    • DefaultNameStrategy

      public DefaultNameStrategy()
  • Method Details

    • getFullName

      public String getFullName(String script) throws ScriptException
      Description copied from interface: NameStrategy
      Returns the fully qualified name of the Java class in the specified script.
      Specified by:
      getFullName in interface NameStrategy
      Parameters:
      script - the Java script
      Returns:
      the fully qualified class name
      Throws:
      ScriptException - if no class name could be determined