@Override public boolean isEmpty() { for (final Map<String, String> map : maps) { if (!map.isEmpty()) { return false; } } return registry.getVariableMap().isEmpty(); }
/** * Gets the variable value * * @param descriptor the descriptor for which to lookup the variable value. * @return the variable value if the given descriptor is equivalent to one * of the entries in the registry; null otherwise */ default String getVariableValue(final VariableDescriptor descriptor) { if (descriptor == null) { return null; } return getVariableMap().get(descriptor); }
/** * Gets the variable value * * @param name the string name of the VariableDescriptor that is the key of * the value to lookup. * @return the value associated with the given variable name if found; null * otherwise */ default String getVariableValue(final String name) { if (name == null) { return null; } return getVariableMap().get(new VariableDescriptor(name)); }
@Override public Set<Entry<String, String>> entrySet() { final Map<String, String> newMap = new HashMap<>(); //put variable registry entries first for (final Map.Entry<VariableDescriptor, String> entry : registry.getVariableMap().entrySet()) { newMap.put(entry.getKey().getName(), entry.getValue()); } //put attribute maps in reverse order final List<Map<String,String>> listOfMaps = new ArrayList<>(maps); Collections.reverse(listOfMaps); for(final Map<String,String> map : listOfMaps){ for(final Map.Entry<String, String> entry : map.entrySet()){ newMap.put(entry.getKey(), entry.getValue()); } } return newMap.entrySet(); }
/** * Returns the VariableDescriptor for the given key name if it exists. * * @param name the string name of the VariableDescriptor to lookup. * @return the variable descriptor registered for this name if it exists; * null otherwise */ default VariableDescriptor getVariableKey(final String name) { if (name == null) { return null; } final VariableDescriptor spec = new VariableDescriptor(name); for (final Map.Entry<VariableDescriptor, String> entry : getVariableMap().entrySet()) { if (entry.getKey().equals(spec)) { return entry.getKey(); } } return null; }
public FileBasedVariableRegistry(final Path[] propertiesPaths) { final Map<VariableDescriptor, String> newMap = new HashMap<>(VariableRegistry.ENVIRONMENT_SYSTEM_REGISTRY.getVariableMap()); final int systemEnvPropCount = newMap.size(); int totalPropertiesLoaded = systemEnvPropCount;
for (final Map.Entry<VariableDescriptor, String> entry : variableRegistry.getVariableMap().entrySet()) { addVariable(element, entry.getKey().getName(), entry.getValue());
public FileBasedVariableRegistry(final Path[] propertiesPaths) { final Map<VariableDescriptor, String> newMap = new HashMap<>(VariableRegistry.ENVIRONMENT_SYSTEM_REGISTRY.getVariableMap()); final int systemEnvPropCount = newMap.size(); int totalPropertiesLoaded = systemEnvPropCount;
public FileBasedVariableRegistry(final Path[] propertiesPaths) { final Map<VariableDescriptor, String> newMap = new HashMap<>(VariableRegistry.ENVIRONMENT_SYSTEM_REGISTRY.getVariableMap()); final int systemEnvPropCount = newMap.size(); int totalPropertiesLoaded = systemEnvPropCount;