PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/plugin-module-codegen-api/src/main/java/com/atlassian/plugins/codegen/I18nString.java

https://bitbucket.org/mmeinhold/amps
Java | 45 lines | 35 code | 7 blank | 3 comment | 0 complexity | 0808ce6ffc132daf777c521ca3698adc MD5 | raw file
 1package com.atlassian.plugins.codegen;
 2
 3import java.util.Map;
 4
 5import com.google.common.base.Function;
 6import com.google.common.collect.Iterables;
 7
 8/**
 9 * Describes an key-value pair that should be added to the plugin project's I18n strings file.
10 */
11public class I18nString extends AbstractPropertyValue implements PluginProjectChange, SummarizeAsGroup
12{
13    public static I18nString i18nString(String name, String value)
14    {
15        return new I18nString(name, value);
16    }
17
18    public static Iterable<I18nString> i18nStrings(Map<String, String> map)
19    {
20        return Iterables.<Map.Entry<String, String>, I18nString>transform(map.entrySet(), new Function<Map.Entry<String, String>, I18nString>()
21        {
22            public I18nString apply(Map.Entry<String, String> entry)
23            {
24                return new I18nString(entry.getKey(), entry.getValue());
25            }
26        });
27    }
28    
29    private I18nString(String name, String value)
30    {
31        super(name, value);
32    }
33
34    @Override
35    public String getGroupName()
36    {
37        return "i18n strings";
38    }
39    
40    @Override
41    public String toString()
42    {
43        return "[i18n: " + super.toString() + "]";
44    }
45}