1   package com.atlassian.plugins.codegen;
2   
3   import java.util.Map;
4   
5   import com.google.common.base.Function;
6   import 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   */
11  public 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  }