/** {@inheritDoc} */ @Override public void deleteProperty(String name) { if (!existProperty(name)) { throw new PropertyNotFoundException(name); } getCacheManager().evictProperty(name); }
/** {@inheritDoc} */ @Override public void updateProperty(String name, String newValue) { Property<?> fp = readProperty(name); fp.setValueFromString(newValue); updateProperty(fp); }
/** {@inheritDoc} */ @Override public boolean existProperty(String name) { Util.assertParamHasLength(name, "Property name"); return getCacheManager().getProperty(name) != null; }
/** {@inheritDoc} */ @Override public Set<String> listPropertyNames() { Set<String> setOfPropertyNames = new HashSet<>(); getCacheManager().getPropertiesCache().forEach(e->setOfPropertyNames.add(e.getKey())); return setOfPropertyNames; }
/** {@inheritDoc} */ @Override public Property<?> readProperty(String name) { if (!existProperty(name)) { throw new PropertyNotFoundException(name); } return getCacheManager().getProperty(name); }
/** {@inheritDoc} */ @Override public void clear() { getCacheManager().getPropertiesCache().removeAll(); }
/** {@inheritDoc} */ @Override public <T> void createProperty(Property<T> property) { if (property == null) { throw new IllegalArgumentException("Property cannot be null nor empty"); } if (existProperty(property.getName())) { throw new PropertyAlreadyExistException(property.getName()); } getCacheManager().putProperty(property); }
/** {@inheritDoc} */ @Override public Map<String, Property<?>> readAllProperties() { Map<String, Property<?>> myMap = new HashMap<>(); getCacheManager().getPropertiesCache().forEach(e->myMap.put(e.getKey(), e.getValue())); return myMap; }
/** {@inheritDoc} */ @Override public <T> void updateProperty(Property<T> property) { if (property == null) { throw new IllegalArgumentException("Property cannot be null"); } if (!existProperty(property.getName())) { throw new PropertyNotFoundException(property.getName()); } getCacheManager().putProperty(property); }