Class EditorVariablesBase

java.lang.Object
ro.sync.util.editorvars.EditorVariablesBase
All Implemented Interfaces:
EditorVariablesConstants
Direct Known Subclasses:
EditorVariables

@API(type=NOT_EXTENDABLE, src=PRIVATE) public class EditorVariablesBase extends Object implements EditorVariablesConstants
Base for EditorVariables. Needed in the beginning to avoid a class cycle.
  • Method Details

    • expandEnvAndSystem

      public static String expandEnvAndSystem(String expr)
      Expand the environment and system variables.
      Parameters:
      expr - The expression containing environment and system variables.
      Returns:
      The expression with the environment and system variables expanded.
    • registerEnvAndSystemResolver

      protected static void registerEnvAndSystemResolver(ro.sync.util.editorvars.expander.EditorVariableExpander expander)
      Register the resolvers for the environment and system variables.
      Parameters:
      expander - The expander where to register the resolvers.
    • getName

      protected static final String getName(String editorVariable)
      Get the name of the given editor variable.

      For example, for "${pd}", get "pd."
      Parameters:
      editorVariable - The editor variable.
      Returns:
      the name.
    • fastEquals

      protected static final boolean fastEquals(String varName, String varPrefix)
      Checks if the variable name is the one that appears inside the prefix form. A prefix form is either ${varName} or ${varName(
      Parameters:
      varName - Variable name.
      varPrefix - ${varName} or ${varName(
      Returns:
      true if the variable name is the one present inside the prefix form.
    • replaceFunctions

      public static String replaceFunctions(String expr, String functionVariablePrefix, String functionVariableSuffix, EditorVariables.FunctionResolver keyToValueMap)
      Replace all functions with the value taken from the map corresponding to the key
      Parameters:
      expr - The expression to modify.
      functionVariablePrefix - Prefix of function signature.
      functionVariableSuffix - Suffix of function signature.
      keyToValueMap - Map between keys and values.
      Returns:
      The processed expression.