protected ConcurrentMap<String, String> forScope(Scope scope) { if (scope != null) { return systemVariables.computeIfAbsent(scope, entities -> new ConcurrentHashMap<>()); } // return most prior scope variables if scope is not defined List<ConcurrentMap<String, String>> orderedSystemVariablesByScopePriority = getOrderedSystemVariablesByScopePriority(); return orderedSystemVariablesByScopePriority.isEmpty() ? null : orderedSystemVariablesByScopePriority.get(0); }
/** * Get the variable with the specified name, from the highest priority scope that contain it. * * @param name the name of the variable; may not be null * @return the variable value; may be null if the variable is not currently set */ public String getVariable(String name) { List<ConcurrentMap<String, String>> orderedSystemVariablesByPriority = getOrderedSystemVariablesByScopePriority(); name = variableName(name); for (ConcurrentMap<String, String> variablesByScope : orderedSystemVariablesByPriority) { String variableName = variablesByScope.get(name); if (variableName != null) { return variableName; } } return null; }
protected ConcurrentMap<String, String> forScope(Scope scope) { if (scope != null) { return systemVariables.computeIfAbsent(scope, entities -> new ConcurrentHashMap<>()); } // return most prior scope variables if scope is not defined List<ConcurrentMap<String, String>> orderedSystemVariablesByScopePriority = getOrderedSystemVariablesByScopePriority(); return orderedSystemVariablesByScopePriority.isEmpty() ? null : orderedSystemVariablesByScopePriority.get(0); }
/** * Get the variable with the specified name, from the highest priority scope that contain it. * * @param name the name of the variable; may not be null * @return the variable value; may be null if the variable is not currently set */ public String getVariable(String name) { List<ConcurrentMap<String, String>> orderedSystemVariablesByPriority = getOrderedSystemVariablesByScopePriority(); name = variableName(name); for (ConcurrentMap<String, String> variablesByScope : orderedSystemVariablesByPriority) { String variableName = variablesByScope.get(name); if (variableName != null) { return variableName; } } return null; }