/** * Constructs a {@link SystemProperties} based on a standard * {@link Properties} representation. * * @param properties the {@link Properties} to use as the basis for the * {@link SystemProperties} */ public SystemProperties(Properties properties) { this(); for (String key : properties.stringPropertyNames()) { this.properties.put(key, SystemProperty.of(key, properties.getProperty(key))); } }
/** * Constructs a {@link SystemProperty} with no value. * * @param name the name of the {@link SystemProperty} * @param options then {@link Option}s for this {@link SystemProperty} * * @return a new {@link SystemProperty} */ public static SystemProperty of(String name, Option... options) { return new SystemProperty(name, "", options); }
@Override public SystemProperties without(SystemProperty property) { return remove(property.getName()); }
String name = property.getName(); Object value = property.getValue(); OptionsByType propertyOptions = property.getOptions(); Iterable<SystemProperty.ResolveHandler> handlers = propertyOptions.getInstancesOf(SystemProperty.ResolveHandler.class);
/** * Obtains the current value of the specified {@link SystemProperty}. If the property has * a value specified, that value will be used. If the property is unknown, * <code>null</code> will be returned. * * @param name the name of the property * * @return an {@link Object} */ public Object getProperty(String name) { if (properties.containsKey(name)) { SystemProperty property = properties.get(name); return property.getValue(); } else { return null; } }
String name = property.getName(); Object value = property.getValue(); OptionsByType propertyOptions = property.getOptions(); Iterable<SystemProperty.ResolveHandler> handlers = propertyOptions.getInstancesOf(SystemProperty.ResolveHandler.class);
/** * Obtains the current value of the specified {@link SystemProperty}. If the property has * a value specified, that value will be used. If the property is unknown, * <code>null</code> will be returned. * * @param name the name of the property * * @return an {@link Object} */ public Object getProperty(String name) { if (properties.containsKey(name)) { SystemProperty property = properties.get(name); return property.getValue(); } else { return null; } }
/** * Constructs a {@link SystemProperties} with properties based on a * {@link Map} of name-value pairs. * * @param properties the {@link Map} of properties to use as the basis for * the {@link SystemProperties} */ public SystemProperties(Map<String, String> properties) { this(); for (String name : properties.keySet()) { this.properties.put(name, SystemProperty.of(name, properties.get(name))); } }
@Override public SystemProperties without(SystemProperty property) { return remove(property.getName()); }
/** * Constructs a {@link SystemProperty} with no value. * * @param name the name of the {@link SystemProperty} * @param options then {@link Option}s for this {@link SystemProperty} * * @return a new {@link SystemProperty} */ public static SystemProperty of(String name, Option... options) { return new SystemProperty(name, "", options); }
/** * Constructs a {@link SystemProperties} with properties based on a * {@link Map} of name-value pairs. * * @param properties the {@link Map} of properties to use as the basis for * the {@link SystemProperties} */ public SystemProperties(Map<String, String> properties) { this(); for (String name : properties.keySet()) { this.properties.put(name, SystemProperty.of(name, properties.get(name))); } }
/** * Adds all of the {@link SystemProperties} to this {@link SystemProperties} * returning a new {@link SystemProperties}. * * @param properties the {@link SystemProperties} * * @return a new {@link SystemProperties} */ public SystemProperties addAll(SystemProperties properties) { SystemProperties systemProperties = new SystemProperties(this); for (SystemProperty property : properties) { systemProperties.properties.put(property.getName(), property); } return systemProperties; }
/** * Constructs a {@link SystemProperty}. * * @param name the name of the {@link SystemProperty} * @param value the value of the {@link SystemProperty} * @param options then {@link Option}s for this {@link SystemProperty} * * @return a new {@link SystemProperty} */ public static SystemProperty of(String name, ContextSensitiveValue value, Option... options) { return new SystemProperty(name, value, options); }
/** * Constructs a {@link SystemProperties} based on a standard * {@link Properties} representation. * * @param properties the {@link Properties} to use as the basis for the * {@link SystemProperties} */ public SystemProperties(Properties properties) { this(); for (String key : properties.stringPropertyNames()) { this.properties.put(key, SystemProperty.of(key, properties.getProperty(key))); } }
/** * Adds all of the {@link SystemProperties} to this {@link SystemProperties} * returning a new {@link SystemProperties}. * * @param properties the {@link SystemProperties} * * @return a new {@link SystemProperties} */ public SystemProperties addAll(SystemProperties properties) { SystemProperties systemProperties = new SystemProperties(this); for (SystemProperty property : properties) { systemProperties.properties.put(property.getName(), property); } return systemProperties; }
/** * Constructs a {@link SystemProperty}. * * @param name the name of the {@link SystemProperty} * @param iterator the iterator that can provide values for the {@link SystemProperty} * @param options then {@link Option}s for this {@link SystemProperty} * * @return a new {@link SystemProperty} */ public static SystemProperty of(String name, Iterator iterator, Option... options) { return new SystemProperty(name, iterator, options); }
/** * Adds all of the specified properties represented as a {@link Map} of name-value pairs * as individual {@link SystemProperty}s, returning a new {@link SystemProperties}. * * @param properties the {@link Map} of properties * * @return a new {@link SystemProperties} */ public SystemProperties addAll(Map<String, Object> properties) { SystemProperties systemProperties = new SystemProperties(this); for (String name : properties.keySet()) { systemProperties.properties.put(name, SystemProperty.of(name, properties.get(name))); } return systemProperties; }
/** * Adds the specified {@link SystemProperty} to the {@link SystemProperties}, returning a new * {@link SystemProperties} containing the {@link SystemProperty} * (if and only if a {@link SystemProperty} with the same name doesn't already exist). * * @param property the {@link SystemProperty} to add * * @return the a new {@link SystemProperties} instance, including the existing {@link SystemProperty}s and the new {@link SystemProperty} */ public SystemProperties addIfAbsent(SystemProperty property) { if (property == null || properties.containsKey(property.getName())) { return this; } else { return add(property); } }
/** * Constructs a {@link SystemProperty}. * * @param name the name of the {@link SystemProperty} * @param value the value of the {@link SystemProperty} * @param options then {@link Option}s for this {@link SystemProperty} * * @return a new {@link SystemProperty} */ public static SystemProperty of(String name, String value, Option... options) { return new SystemProperty(name, value, options); }
/** * Adds all of the specified properties represented as a {@link Map} of name-value pairs * as individual {@link SystemProperty}s, returning a new {@link SystemProperties}. * * @param properties the {@link Map} of properties * * @return a new {@link SystemProperties} */ public SystemProperties addAll(Map<String, Object> properties) { SystemProperties systemProperties = new SystemProperties(this); for (String name : properties.keySet()) { systemProperties.properties.put(name, SystemProperty.of(name, properties.get(name))); } return systemProperties; }