public static boolean isValidVariable(@Nullable String var) {
    return var != null && var.length() > 2 && StringUtil.startsWithChar(var, '$') && StringUtil.endsWithChar(var, '$') &&
           isValidVariableName(var.substring(1, var.length() - 1));
  }
public static boolean isValidVariable(@Nullable String var)