/** * Constructs a {@link EnvironmentVariable} based on another {@link EnvironmentVariable}. * * @param property the {@link EnvironmentVariable} from which to construct * (copy) the new {@link EnvironmentVariable} */ private EnvironmentVariable(EnvironmentVariable property) { this.name = property.getName(); this.value = property.getValue(); }
@Override public EnvironmentVariables with(EnvironmentVariable variable) { EnvironmentVariables environmentVariables = new EnvironmentVariables(this); environmentVariables.variables.put(variable.getName(), variable); return environmentVariables; }
/** * Constructs a {@link EnvironmentVariable} based on another {@link EnvironmentVariable}. * * @param property the {@link EnvironmentVariable} from which to construct * (copy) the new {@link EnvironmentVariable} */ private EnvironmentVariable(EnvironmentVariable property) { this.name = property.getName(); this.value = property.getValue(); }
@Override public EnvironmentVariables with(EnvironmentVariable variable) { EnvironmentVariables environmentVariables = new EnvironmentVariables(this); environmentVariables.variables.put(variable.getName(), variable); return environmentVariables; }
@Override public EnvironmentVariables without(EnvironmentVariable variable) { if (variables.containsKey(variable.getName())) { EnvironmentVariables environmentVariables = new EnvironmentVariables(this); environmentVariables.variables.remove(variable); return environmentVariables; } else { return this; } }
@Override public EnvironmentVariables without(EnvironmentVariable variable) { if (variables.containsKey(variable.getName())) { EnvironmentVariables environmentVariables = new EnvironmentVariables(this); environmentVariables.variables.remove(variable); return environmentVariables; } else { return this; } }
/** * Obtain a new {@link EnvironmentVariables} that is the union of * this {@link EnvironmentVariables} and the specified {@link Collection} * of {@link EnvironmentVariable} instances. * <p> * If an {@link EnvironmentVariable} with a given name is present in * this {@link EnvironmentVariables} and in the {@link Collection} being * added then the value being added takes precedence. * * @param variables the {@link EnvironmentVariable}s to union with * this {@link EnvironmentVariables} * * @return a new {@link EnvironmentVariables} that is the union * of this {@link EnvironmentVariables} and the specified * array of {@link EnvironmentVariable} instances */ public EnvironmentVariables with(Collection<EnvironmentVariable> variables) { if (variables == null || variables.isEmpty()) { return this; } EnvironmentVariables environmentVariables = new EnvironmentVariables(this); for (EnvironmentVariable variable : variables) { environmentVariables.variables.put(variable.getName(), variable); } return environmentVariables; }
/** * Obtain a new {@link EnvironmentVariables} that is the union of * this {@link EnvironmentVariables} and the specified {@link Collection} * of {@link EnvironmentVariable} instances. * <p> * If an {@link EnvironmentVariable} with a given name is present in * this {@link EnvironmentVariables} and in the {@link Collection} being * added then the value being added takes precedence. * * @param variables the {@link EnvironmentVariable}s to union with * this {@link EnvironmentVariables} * * @return a new {@link EnvironmentVariables} that is the union * of this {@link EnvironmentVariables} and the specified * array of {@link EnvironmentVariable} instances */ public EnvironmentVariables with(Collection<EnvironmentVariable> variables) { if (variables == null || variables.isEmpty()) { return this; } EnvironmentVariables environmentVariables = new EnvironmentVariables(this); for (EnvironmentVariable variable : variables) { environmentVariables.variables.put(variable.getName(), variable); } return environmentVariables; }
String name = variable.getName(); Object value = variable.getValue();
String name = variable.getName(); Object value = variable.getValue();