/** * Get a List of strings associated with the given configuration key. * <p> * The list is a copy of the internal data of this object, and as * such you may alter it freely. * * @param key The configuration key. * @return The associated List object. * @throws ClassCastException is thrown if the key maps to an * object that is not a List. * @since Commons Collections 3.2 */ public List getList(String key) { return getList(key, null); }
/** * Get a List of strings associated with the given configuration key. * <p> * The list is a copy of the internal data of this object, and as * such you may alter it freely. * * @param key The configuration key. * @return The associated List object. * @throws ClassCastException is thrown if the key maps to an * object that is not a List. * @since Commons Collections 3.2 */ public List getList(String key) { return getList(key, null); }
return defaults.getList(key, defaultValue); } else { return ((defaultValue == null) ? new ArrayList() : defaultValue);
return defaults.getList(key, defaultValue); } else { return ((defaultValue == null) ? new ArrayList() : defaultValue);
public void testMultipleSameKey1() throws Exception { ExtendedProperties ep1 = new ExtendedProperties(); /* initialize using: one=a one=b,c */ String s1 = "one=a\none=b,c\n"; byte[] bytes = s1.getBytes(); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); ep1.load(bais); assertEquals(1, ep1.size()); assertEquals(3, ep1.getVector("one").size()); assertEquals("a", ep1.getVector("one").get(0)); assertEquals("b", ep1.getVector("one").get(1)); assertEquals("c", ep1.getVector("one").get(2)); assertEquals(3, ep1.getList("one").size()); assertEquals("a", ep1.getList("one").get(0)); assertEquals("b", ep1.getList("one").get(1)); assertEquals("c", ep1.getList("one").get(2)); }
public void testMultipleSameKey3() throws Exception { ExtendedProperties ep1 = new ExtendedProperties(); /* initialize using: one=a,b one=c */ String s1 = "one=a,b\none=c\n"; byte[] bytes = s1.getBytes(); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); ep1.load(bais); assertEquals(1, ep1.size()); assertEquals(3, ep1.getVector("one").size()); assertEquals("a", ep1.getVector("one").get(0)); assertEquals("b", ep1.getVector("one").get(1)); assertEquals("c", ep1.getVector("one").get(2)); assertEquals(3, ep1.getList("one").size()); assertEquals("a", ep1.getList("one").get(0)); assertEquals("b", ep1.getList("one").get(1)); assertEquals("c", ep1.getList("one").get(2)); }
public void testMultipleSameKey2() throws Exception { ExtendedProperties ep1 = new ExtendedProperties(); /* initialize using: one=a,b one=c,d */ String s1 = "one=a,b\none=c,d\n"; byte[] bytes = s1.getBytes(); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); ep1.load(bais); assertEquals(1, ep1.size()); assertEquals(4, ep1.getVector("one").size()); assertEquals("a", ep1.getVector("one").get(0)); assertEquals("b", ep1.getVector("one").get(1)); assertEquals("c", ep1.getVector("one").get(2)); assertEquals("d", ep1.getVector("one").get(3)); assertEquals(4, ep1.getList("one").size()); assertEquals("a", ep1.getList("one").get(0)); assertEquals("b", ep1.getList("one").get(1)); assertEquals("c", ep1.getList("one").get(2)); assertEquals("d", ep1.getList("one").get(3)); }
assertEquals("a", ep1.getVector("one").get(0)); assertEquals(1, ep1.getList("one").size()); assertEquals("a", ep1.getList("one").get(0)); assertEquals(Boolean.TRUE, ep1.getVector("one").get(1)); assertEquals(2, ep1.getList("one").size()); assertEquals("a", ep1.getList("one").get(0)); assertEquals(Boolean.TRUE, ep1.getList("one").get(1)); assertEquals("d", ep1.getVector("one").get(3)); assertEquals(4, ep1.getList("one").size()); assertEquals("a", ep1.getList("one").get(0)); assertEquals(Boolean.TRUE, ep1.getList("one").get(1)); assertEquals("c", ep1.getList("one").get(2)); assertEquals("d", ep1.getList("one").get(3));
assertTrue("This returns array", (eprop.getList("number") instanceof java.util.List)); eprop.setProperty("prop.string", prop); assertTrue("This returns vector", (eprop.getVector("prop.string") instanceof java.util.Vector)); assertTrue("This returns list", (eprop.getList("prop.string") instanceof java.util.List)); assertTrue("This returns string for subset", (subEprop.getString("string") instanceof java.lang.String)); assertTrue("This returns array for subset", (subEprop.getVector("string") instanceof java.util.Vector)); assertTrue("This returns array for subset", (subEprop.getList("string") instanceof java.util.List));
/** * Get a List of strings associated with the given configuration key. * <p> * The list is a copy of the internal data of this object, and as * such you may alter it freely. * * @param key The configuration key. * @return The associated List object. * @throws ClassCastException is thrown if the key maps to an * object that is not a List. * @since Commons Collections 3.2 */ public List getList(String key) { return getList(key, null); }
/** * Get a List of strings associated with the given configuration key. * <p> * The list is a copy of the internal data of this object, and as * such you may alter it freely. * * @param key The configuration key. * @return The associated List object. * @throws ClassCastException is thrown if the key maps to an * object that is not a List. * @since Commons Collections 3.2 */ public List getList(String key) { return getList(key, null); }
/** * Get a List of strings associated with the given configuration key. * <p> * The list is a copy of the internal data of this object, and as * such you may alter it freely. * * @param key The configuration key. * @return The associated List object. * @throws ClassCastException is thrown if the key maps to an * object that is not a List. * @since Commons Collections 3.2 */ public List getList(String key) { return getList(key, null); }
/** * Get a List of strings associated with the given configuration key. * <p> * The list is a copy of the internal data of this object, and as * such you may alter it freely. * * @param key The configuration key. * @return The associated List object. * @throws ClassCastException is thrown if the key maps to an * object that is not a List. * @since Commons Collections 3.2 */ public List getList(String key) { return getList(key, null); }
/** * Get a List of strings associated with the given configuration key. * <p> * The list is a copy of the internal data of this object, and as * such you may alter it freely. * * @param key The configuration key. * @return The associated List object. * @throws ClassCastException is thrown if the key maps to an * object that is not a List. * @since Commons Collections 3.2 */ public List getList(String key) { return getList(key, null); }
return defaults.getList(key, defaultValue); } else { return ((defaultValue == null) ? new ArrayList() : defaultValue);
return defaults.getList(key, defaultValue); } else { return ((defaultValue == null) ? new ArrayList() : defaultValue);
return defaults.getList(key, defaultValue); } else { return ((defaultValue == null) ? new ArrayList() : defaultValue);
/** * Append Velocimacro Library into {@link Velocity} {@link Properties} * * @param velocityProperties {@link Velocity} {@link Properties} * @param libraryPath the path of Velocimacro Library */ public static void appendVelocimacroLibrary(Map<String, String> velocityProperties, String libraryPath) { String propertyName = RuntimeConstants.VM_LIBRARY; ExtendedProperties extendedProperties = toSingletonExtendedProperties(velocityProperties, propertyName); extendedProperties.addProperty(propertyName, libraryPath); List<String> listValue = extendedProperties.getList(propertyName); String propertyValue = StringUtils.collectionToCommaDelimitedString(listValue); velocityProperties.put(propertyName, propertyValue); }
/** * Append Velocimacro Library into {@link Velocity} {@link Properties} * * @param velocityProperties {@link Velocity} {@link Properties} * @param libraryPath the path of Velocimacro Library */ public static void appendVelocimacroLibrary(Map<String, String> velocityProperties, String libraryPath) { String propertyName = RuntimeConstants.VM_LIBRARY; ExtendedProperties extendedProperties = toSingletonExtendedProperties(velocityProperties, propertyName); extendedProperties.addProperty(propertyName, libraryPath); List<String> listValue = extendedProperties.getList(propertyName); String propertyValue = StringUtils.collectionToCommaDelimitedString(listValue); velocityProperties.put(propertyName, propertyValue); }