public static void appendToMap(Map<?, ?> p, String para) { appendToMap(p, para, '=', ':'); }
public MProperties(String ... values) { this(new Properties()); if (values != null) { for (int i = 0; i < values.length; i+=2) { if (i+1 < values.length) appendToMap(this, values[i] + "=" + values[i+1], '=', ':'); } } }
/** * This will handle the strings like properties. Means a string without separator will be * stored as value with an increasing key as integer, e.g. [val1, val2, a=b] will be 0=val1, 1=val2, a=b * @param properties * @return The Properties */ public static Properties explodeToProperties(String[] properties) { Properties p = new Properties(); if (properties != null) { for (String i : properties) { if (i != null) { appendToMap(p, i, '=', ':'); } } } return p; }
public static MProperties explodeToMProperties(String[] properties, char keySeparator, char typeSeparator, int offset, int length) { MProperties p = new MProperties(); if (properties != null) { for (int i = 0; i < length; i++) { int pos = i + offset; if (pos >= properties.length) break; String item = properties[pos]; if (item != null) appendToMap(p, item, keySeparator, typeSeparator); } } return p; }