/** * Set a context property to a new value. * * @param desc the property descriptor * @param value the property value * @param <T> the property parameter type * @throws NullPointerException if the descriptor argument or the value is null * @throws IllegalArgumentException if the string value cannot be converted to the property type */ <T> void parseProperty(PropertyDescriptor<T> desc, String value) throws NullPointerException, IllegalArgumentException { if (desc == null) { throw new NullPointerException("No null descriptor allowed"); } if (value == null) { throw new NullPointerException("No null value accepted"); } else { Property<T> property = desc.toProperty(value); log.log(Level.FINE, "Setting property " + desc.name + " to value " + property.getValue()); properties.put(desc.getName(), property); } } }
/** * Set a context property to a new value. * * @param desc the property descriptor * @param value the property value * @param <T> the property parameter type * @throws NullPointerException if the descriptor argument or the value is null * @throws IllegalArgumentException if the string value cannot be converted to the property type */ <T> void parseProperty(PropertyDescriptor<T> desc, String value) throws NullPointerException, IllegalArgumentException { if (desc == null) { throw new NullPointerException("No null descriptor allowed"); } if (value == null) { throw new NullPointerException("No null value accepted"); } else { Property<T> property = desc.toProperty(value); log.log(Level.FINE, "Setting property " + desc.name + " to value " + property.getValue()); properties.put(desc.getName(), property); } } }
/** * Set a context property to a new value. * * @param desc the property descriptor * @param value the property value * @param <T> the property parameter type * @throws NullPointerException if the descriptor argument or the value is null * @throws IllegalArgumentException if the string value cannot be converted to the property type */ <T> void parseProperty(PropertyDescriptor<T> desc, String value) throws NullPointerException, IllegalArgumentException { if (desc == null) { throw new NullPointerException("No null descriptor allowed"); } if (value == null) { throw new NullPointerException("No null value accepted"); } else { Property<T> property = desc.toProperty(value); log.log(Level.FINE, "Setting property " + desc.name + " to value " + property.getValue()); properties.put(desc.getName(), property); } } }
/** * Set a context property to a new value. If the provided value is null, then the property is removed. * * @param desc the property descriptor * @param value the property value * @param <T> the property parameter type * @throws NullPointerException if the descriptor argument is null * @throws IllegalArgumentException if the string value cannot be converted to the property type */ <T> void setProperty(PropertyDescriptor<T> desc, String value) throws NullPointerException, IllegalArgumentException { if (desc == null) { throw new NullPointerException(); } if (value == null) { log.log(Level.FINE, "Removing property " + desc.name); properties.remove(desc.getName()); } else { Property<T> property = desc.toProperty(value); log.log(Level.FINE, "Setting property " + desc.name + " to value " + property.getValue()); properties.put(desc.getName(), property); } } }