modules/jdk.packager/src/main/java/com/oracle/tools/packager/EnumeratedBundlerParam.java

Print this page




  32 /**
  33  *
  34  * The class contains key-value pairs (elements) where keys are "displayable" keys
  35  * which the IDE can display/choose and values are "identifier" values which can be stored
  36  * in parameters' map.
  37  *
  38  * For instance the Mac has a predefined set of categories which can be applied
  39  * to LSApplicationCategoryType which is required for the mac app store.
  40  *
  41  * The following example illustrates a simple usage of the MAC_CATEGORY parameter:
  42  *
  43  * <pre>{@code
  44  *     Set<String> keys = MAC_CATEGORY.getDisplayableKeys();
  45  *
  46  *     String key = getLastValue(keys); // get last value for example
  47  *
  48  *     String value = MAC_CATEGORY.getValueForDisplayableKey(key);
  49  *     params.put(MAC_CATEGORY.getID(), value);
  50  * }</pre>
  51  *

  52  */

  53 public class EnumeratedBundlerParam<T> extends BundlerParamInfo<T> {
  54     //Not sure if this is the correct order, my idea is that from and IDE's perspective
  55     //the string to display to the user is the key and then the value is some type of
  56     //object (although probably a String in most cases)
  57     private Map<String, T> elements;
  58     private boolean strict;
  59 
  60     public EnumeratedBundlerParam(String name,
  61                                   String description,
  62                                   String id,
  63                                   Class<T> valueType,
  64                                   Function<Map<String, ? super Object>, T> defaultValueFunction,
  65                                   BiFunction<String, Map<String, ? super Object>, T> stringConverter,
  66                                   Map<String, T> elements,
  67                                   boolean strict) {
  68         this.name = name;
  69         this.description = description;
  70         this.id = id;
  71         this.valueType = valueType;
  72         this.defaultValueFunction = defaultValueFunction;




  32 /**
  33  *
  34  * The class contains key-value pairs (elements) where keys are "displayable" keys
  35  * which the IDE can display/choose and values are "identifier" values which can be stored
  36  * in parameters' map.
  37  *
  38  * For instance the Mac has a predefined set of categories which can be applied
  39  * to LSApplicationCategoryType which is required for the mac app store.
  40  *
  41  * The following example illustrates a simple usage of the MAC_CATEGORY parameter:
  42  *
  43  * <pre>{@code
  44  *     Set<String> keys = MAC_CATEGORY.getDisplayableKeys();
  45  *
  46  *     String key = getLastValue(keys); // get last value for example
  47  *
  48  *     String value = MAC_CATEGORY.getValueForDisplayableKey(key);
  49  *     params.put(MAC_CATEGORY.getID(), value);
  50  * }</pre>
  51  *
  52  * @deprecated use {@link ToolProvider} to locate the {@code "javapackager"} tool instead.
  53  */
  54 @Deprecated(since="10", forRemoval=true)
  55 public class EnumeratedBundlerParam<T> extends BundlerParamInfo<T> {
  56     //Not sure if this is the correct order, my idea is that from and IDE's perspective
  57     //the string to display to the user is the key and then the value is some type of
  58     //object (although probably a String in most cases)
  59     private Map<String, T> elements;
  60     private boolean strict;
  61 
  62     public EnumeratedBundlerParam(String name,
  63                                   String description,
  64                                   String id,
  65                                   Class<T> valueType,
  66                                   Function<Map<String, ? super Object>, T> defaultValueFunction,
  67                                   BiFunction<String, Map<String, ? super Object>, T> stringConverter,
  68                                   Map<String, T> elements,
  69                                   boolean strict) {
  70         this.name = name;
  71         this.description = description;
  72         this.id = id;
  73         this.valueType = valueType;
  74         this.defaultValueFunction = defaultValueFunction;