Class ScriptDefinition


public final class ScriptDefinition

Describes a reusable script source and its implementation class.

Definitions are registered with ScriptManager.setDefinitions(Collection) and referenced by ScriptBinding.getScript(). Source resolution and compilation are delegated to the selected ScriptProvider.

  • Constructor Details

    • ScriptDefinition

      public ScriptDefinition()
      Creates an empty JAXB definition.
    • ScriptDefinition

      public ScriptDefinition(String id, String language, String source, String implementation, ScriptHostType host)
      Creates a definition.
      Parameters:
      id - The unique definition identifier.
      language - The provider language identifier.
      source - The source path or resource name.
      implementation - The fully qualified implementation class name.
      host - The required host category.
    • ScriptDefinition

      public ScriptDefinition(ScriptDefinition definition)
      Creates an independent snapshot of another definition.
      Parameters:
      definition - The definition to copy.
  • Method Details

    • validate

      public List<String> validate()
      Validates fields required for registration.
      Returns:
      Human-readable validation errors; empty when valid.
    • getId

      public String getId()
      Returns the unique identifier.
      Returns:
      The identifier.
    • getName

      public String getName()
      Returns the display name.
      Returns:
      The name, or null.
    • getLanguage

      public String getLanguage()
      Returns the provider language identifier.
      Returns:
      The language identifier.
    • getSource

      public String getSource()
      Returns the source path or resource name.
      Returns:
      The source, or null for precompiled code.
    • getImplementation

      public String getImplementation()
      Returns the implementation class name.
      Returns:
      The fully qualified class name.
    • getHost

      public ScriptHostType getHost()
      Returns the required host category.
      Returns:
      The host category.
    • getTargetType

      public String getTargetType()
      Returns an optional required host class.
      Returns:
      The fully qualified type name, or null.
    • setId

      public void setId(String id)
      Sets the unique identifier.
      Parameters:
      id - The identifier.
    • setName

      public void setName(String name)
      Sets the display name.
      Parameters:
      name - The name.
    • setLanguage

      public void setLanguage(String language)
      Sets the provider language identifier.
      Parameters:
      language - The language identifier.
    • setSource

      public void setSource(String source)
      Sets the source path or resource name.
      Parameters:
      source - The source.
    • setImplementation

      public void setImplementation(String implementation)
      Sets the implementation class name.
      Parameters:
      implementation - The fully qualified class name.
    • setHost

      public void setHost(ScriptHostType host)
      Sets the required host category.
      Parameters:
      host - The host category.
    • setTargetType

      public void setTargetType(String targetType)
      Sets an optional required host class.
      Parameters:
      targetType - The fully qualified type name.