public void testGetProperty() { PropertyManager mgr = new PropertyManager(); mgr.setProperty(FOO, foo); Property<Foo> property = mgr.getProperty(FOO); assertEquals(foo, property.getValue()); }
/** * Returns a context property or null if it cannot be found. * * @param desc the property descriptor * @param <T> the property parameter type * @return the property value * @throws NullPointerException if the descriptor argument is null */ public <T> T getProperty(PropertyDescriptor<T> desc) throws NullPointerException { return propertyManager.getPropertyValue(desc); }
/** * 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 */ public <T> void setProperty(PropertyDescriptor<T> desc, String value) throws NullPointerException, IllegalArgumentException { propertyManager.parseProperty(desc, value); }
/** * Returns a property or null if it cannot be found. * * @param desc the property descriptor * @param <T> the property parameter type * @return the property object * @throws NullPointerException if the descriptor argument is null */ public <T> Property<T> getProperty(PropertyDescriptor<T> desc) throws NullPointerException { if (desc == null) { throw new NullPointerException(); } return getProperty(desc.getName(), desc.getType()); }
this.scanner = scanner; this.resourceManager = new ResourceManager(cmdFS, confFS); this.propertyManager = new PropertyManager();
/** * 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 */ public <T> void setProperty(PropertyDescriptor<T> desc, T value) throws NullPointerException { propertyManager.setProperty(desc, value); }
//This has reads in a property file: PropertyManager propertyManager = new PropertyManager(/*prop file location*/); String url = propertyManager.getConfig(DevelopmentConfig.URL);
/** * Returns a property value or null if it cannot be found. * * @param desc the property descriptor * @param <T> the property parameter type * @return the property value * @throws NullPointerException if the descriptor argument is null */ public <T> T getPropertyValue(PropertyDescriptor<T> desc) throws NullPointerException { if (desc == null) { throw new NullPointerException(); } Property<T> property = getProperty(desc.getName(), desc.getType()); return property != null ? property.getValue() : null; }
public class GraphDataParser { private GraphDataStreamReader graphSR; private GraphDataParser(String xmlFile) throws FileNotFoundException, XMLStreamException { FileInputStream inStream = new FileInputStream(new File(xmlFile)); graphSR = new GraphDataStreamReader(inStream, new PropertyManager(1)); } }
/** * 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 */ public <T> void setProperty(PropertyDescriptor<T> desc, T value) throws NullPointerException { propertyManager.setProperty(desc, value); }
public void testDisplayValue() { PropertyManager mgr = new PropertyManager(); mgr.setProperty(PropertyDescriptor.VFS_REFRESH_PERIOD, 4); Property<Integer> property = mgr.getProperty(PropertyDescriptor.VFS_REFRESH_PERIOD); assertEquals("4", property.getDisplayValue()); mgr.setProperty(SimpleAuthenticationPlugin.SIMPLE_PASSWORD, "the_password"); Property<String> secretProperty = mgr.getProperty(SimpleAuthenticationPlugin.SIMPLE_PASSWORD); assertEquals(PropertyDescriptor.SECRET_DISPLAY_VALUE, secretProperty.getDisplayValue()); assertEquals("the_password", secretProperty.getValue()); } }
/** * Returns a context property or null if it cannot be found. * * @param propertyName the name of the property * @param type the property type * @param <T> the property parameter type * @return the property value * @throws NullPointerException if the descriptor argument is null */ public <T> T getProperty(String propertyName, Class<T> type) throws NullPointerException { return propertyManager.getProperty(propertyName, type); }
this.scanner = scanner; this.resourceManager = new ResourceManager(cmdFS, confFS); this.propertyManager = new PropertyManager();
/** * 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 */ public <T> void setProperty(PropertyDescriptor<T> desc, T value) throws NullPointerException { propertyManager.setProperty(desc, value); }
/** * 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 */ public <T> void setProperty(PropertyDescriptor<T> desc, String value) throws NullPointerException, IllegalArgumentException { propertyManager.parseProperty(desc, value); }
/** * Returns a context property or null if it cannot be found. * * @param desc the property descriptor * @param <T> the property parameter type * @return the property value * @throws NullPointerException if the descriptor argument is null */ public <T> T getProperty(PropertyDescriptor<T> desc) throws NullPointerException { return propertyManager.getPropertyValue(desc); }
/** * Returns a context property or null if it cannot be found. * * @param desc the property descriptor * @param <T> the property parameter type * @return the property value * @throws NullPointerException if the descriptor argument is null */ public <T> T getProperty(PropertyDescriptor<T> desc) throws NullPointerException { return propertyManager.getProperty(desc); }
this.scanner = scanner; this.resourceManager = new ResourceManager(cmdFS, confFS); this.propertyManager = new PropertyManager();
/** * 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 */ public <T> void setProperty(PropertyDescriptor<T> desc, T value) throws NullPointerException { propertyManager.setProperty(desc, value); }
/** * 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 */ public <T> void setProperty(PropertyDescriptor<T> desc, String value) throws NullPointerException, IllegalArgumentException { propertyManager.parseProperty(desc, value); }