|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sonar.api.utils.KeyValueFormat
public final class KeyValueFormat
Formats and parses key/value pairs with the string representation : "key1=value1;key2=value2". Conversion of fields is supported and can be extended.
This format can easily be parsed with Ruby code: hash=Hash[*(my_string.split(';').map { |elt| elt.split('=') }.flatten)]
Nested Class Summary | |
---|---|
static class |
KeyValueFormat.Converter<T>
|
static class |
KeyValueFormat.DateConverter
|
static class |
KeyValueFormat.DateTimeConverter
Deprecated. in version 2.13. Replaced by newDateTimeConverter() |
static class |
KeyValueFormat.DoubleConverter
|
static class |
KeyValueFormat.DoubleNumbersPairTransformer
Deprecated. since 2.7. Replaced by Converter |
static class |
KeyValueFormat.IntegerConverter
|
static class |
KeyValueFormat.IntegerNumbersPairTransformer
Deprecated. since 2.7. Replaced by Converter |
static class |
KeyValueFormat.PriorityConverter
|
static class |
KeyValueFormat.RulePriorityNumbersPairTransformer
Deprecated. since 2.7. Replaced by Converter |
static class |
KeyValueFormat.StringConverter
|
static class |
KeyValueFormat.StringNumberPairTransformer
Deprecated. since 2.7 replaced by Converter |
static class |
KeyValueFormat.ToStringConverter
|
static interface |
KeyValueFormat.Transformer<K,V>
Deprecated. since 2.7. Replaced by Converter |
Field Summary | |
---|---|
static String |
FIELD_SEPARATOR
|
static String |
PAIR_SEPARATOR
|
Method Summary | ||
---|---|---|
static String |
format(org.apache.commons.collections.Bag bag)
Deprecated. use Multiset from google collections instead of commons-collections bags |
|
static String |
format(org.apache.commons.collections.Bag bag,
int var)
Deprecated. use Multiset from google collections instead of commons-collections bags |
|
static String |
format(Map map)
|
|
static
|
format(Map<K,V> map,
KeyValueFormat.Converter<K> keyConverter,
KeyValueFormat.Converter<V> valueConverter)
|
|
static
|
format(com.google.common.collect.Multimap<K,V> map,
KeyValueFormat.Converter<K> keyConverter,
KeyValueFormat.Converter<V> valueConverter)
Limitation: there's currently no methods to parse into Multimap. |
|
static String |
format(com.google.common.collect.Multiset multiset)
|
|
static
|
format(com.google.common.collect.Multiset<K> multiset,
KeyValueFormat.Converter<K> keyConverter)
|
|
static String |
formatIntDate(Map<Integer,Date> map)
|
|
static String |
formatIntDateTime(Map<Integer,Date> map)
|
|
static String |
formatIntDouble(Map<Integer,Double> map)
|
|
static String |
formatIntString(Map<Integer,String> map)
|
|
static String |
formatStringInt(Map<String,Integer> map)
|
|
static KeyValueFormat.DateConverter |
newDateConverter()
|
|
static KeyValueFormat.DateConverter |
newDateConverter(String format)
|
|
static KeyValueFormat.DateConverter |
newDateTimeConverter()
|
|
static KeyValueFormat.DoubleConverter |
newDoubleConverter()
|
|
static KeyValueFormat.IntegerConverter |
newIntegerConverter()
|
|
static KeyValueFormat.PriorityConverter |
newPriorityConverter()
|
|
static KeyValueFormat.StringConverter |
newStringConverter()
|
|
static KeyValueFormat.ToStringConverter |
newToStringConverter()
|
|
static Map<String,String> |
parse(String data)
|
|
static
|
parse(String data,
KeyValueFormat.Converter<K> keyConverter,
KeyValueFormat.Converter<V> valueConverter)
|
|
static
|
parse(String data,
KeyValueFormat.Transformer<K,V> transformer)
Deprecated. since 2.7 |
|
static Map<Integer,Date> |
parseIntDate(String data)
|
|
static Map<Integer,Date> |
parseIntDateTime(String data)
|
|
static Map<Integer,Double> |
parseIntDouble(String data)
|
|
static com.google.common.collect.Multiset<Integer> |
parseIntegerMultiset(String data)
|
|
static Map<Integer,Integer> |
parseIntInt(String data)
|
|
static Map<Integer,String> |
parseIntString(String data)
|
|
static com.google.common.collect.Multiset<String> |
parseMultiset(String data)
|
|
static
|
parseMultiset(String data,
KeyValueFormat.Converter<K> keyConverter)
|
|
static Map<String,Double> |
parseStringDouble(String data)
|
|
static Map<String,Integer> |
parseStringInt(String data)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PAIR_SEPARATOR
public static final String FIELD_SEPARATOR
Method Detail |
---|
public static KeyValueFormat.StringConverter newStringConverter()
public static KeyValueFormat.ToStringConverter newToStringConverter()
public static KeyValueFormat.IntegerConverter newIntegerConverter()
public static KeyValueFormat.PriorityConverter newPriorityConverter()
public static KeyValueFormat.DoubleConverter newDoubleConverter()
public static KeyValueFormat.DateConverter newDateConverter()
public static KeyValueFormat.DateConverter newDateTimeConverter()
public static KeyValueFormat.DateConverter newDateConverter(String format)
public static <K,V> Map<K,V> parse(String data, KeyValueFormat.Converter<K> keyConverter, KeyValueFormat.Converter<V> valueConverter)
public static Map<String,String> parse(String data)
public static Map<String,Integer> parseStringInt(String data)
public static Map<String,Double> parseStringDouble(String data)
public static Map<Integer,String> parseIntString(String data)
public static Map<Integer,Double> parseIntDouble(String data)
public static Map<Integer,Date> parseIntDate(String data)
public static Map<Integer,Integer> parseIntInt(String data)
public static Map<Integer,Date> parseIntDateTime(String data)
public static <K> com.google.common.collect.Multiset<K> parseMultiset(String data, KeyValueFormat.Converter<K> keyConverter)
public static com.google.common.collect.Multiset<Integer> parseIntegerMultiset(String data)
public static com.google.common.collect.Multiset<String> parseMultiset(String data)
@Deprecated public static <K,V> Map<K,V> parse(String data, KeyValueFormat.Transformer<K,V> transformer)
data
- the input stringtransformer
- the interface to implement
public static <K,V> String format(Map<K,V> map, KeyValueFormat.Converter<K> keyConverter, KeyValueFormat.Converter<V> valueConverter)
public static String format(Map map)
public static String formatIntString(Map<Integer,String> map)
public static String formatIntDouble(Map<Integer,Double> map)
public static String formatIntDate(Map<Integer,Date> map)
public static String formatIntDateTime(Map<Integer,Date> map)
public static String formatStringInt(Map<String,Integer> map)
public static <K,V> String format(com.google.common.collect.Multimap<K,V> map, KeyValueFormat.Converter<K> keyConverter, KeyValueFormat.Converter<V> valueConverter)
public static <K> String format(com.google.common.collect.Multiset<K> multiset, KeyValueFormat.Converter<K> keyConverter)
public static String format(com.google.common.collect.Multiset multiset)
@Deprecated public static String format(org.apache.commons.collections.Bag bag)
@Deprecated public static String format(org.apache.commons.collections.Bag bag, int var)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |