Interface ScriptVariableResolver

All Known Implementing Classes:
AbstractVariableResolver, DefaultVariableResolver, ObjectVariableResolver, ScriptValue.MapType

public interface ScriptVariableResolver
An interface for structures that map string keys to ScriptValues. As a strict policy, all variable names are CASE-INSENSITIVE.
Author:
Matthew Tropiano
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks if this contains a value by its variable name.
    boolean
    Gets the corresponding value for a variable name.
    boolean
    Checks if this resolver maintains no values.
    boolean
    Checks if an existing value is read-only.
    void
    setValue(String name, ScriptValue value)
    Sets a key-value pair.
    int
     
  • Method Details

    • getValue

      boolean getValue(String name, ScriptValue out)
      Gets the corresponding value for a variable name. Changing the returned value does not change the value, unless it is a reference type like a map or list.
      Parameters:
      name - the variable name.
      out - the destination variable for the value.
      Returns:
      true if a corresponding value was fetched into out, false if not. If false, out is set to the null value.
    • setValue

      void setValue(String name, ScriptValue value)
      Sets a key-value pair. This should fail if the provided name corresponds to a read-only variable.
      Parameters:
      name - the variable name.
      value - the corresponding value.
      Throws:
      IllegalArgumentException - if the provided name refers to a value that is read-only.
      See Also:
    • containsValue

      boolean containsValue(String name)
      Checks if this contains a value by its variable name.
      Parameters:
      name - the variable name.
      Returns:
      true if so, false if not.
    • isReadOnly

      boolean isReadOnly(String name)
      Checks if an existing value is read-only.
      Parameters:
      name - the variable name.
      Returns:
      true if so, false if not.
    • isEmpty

      boolean isEmpty()
      Checks if this resolver maintains no values.
      Returns:
      true if so, false if not.
    • size

      int size()
      Returns:
      the amount of values that this maintains.