jdk.nashorn.internal.runtime.Logging Java Examples

The following examples show how to use jdk.nashorn.internal.runtime.Logging. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Options.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static Option<?> createOption(final OptionTemplate t, final String value) {
    switch (t.getType()) {
    case "string":
        // default value null
        return new Option<>(value);
    case "timezone":
        // default value "TimeZone.getDefault()"
        return new Option<>(TimeZone.getTimeZone(value));
    case "locale":
        return new Option<>(Locale.forLanguageTag(value));
    case "keyvalues":
        return new KeyValueOption(value);
    case "log":
        final KeyValueOption kv = new KeyValueOption(value);
        Logging.initialize(kv.getValues());
        return kv;
    case "boolean":
        return new Option<>(value != null && Boolean.parseBoolean(value));
    case "integer":
        try {
            return new Option<>((value == null) ? 0 : Integer.parseInt(value));
        } catch (final NumberFormatException nfe) {
            throw new IllegalOptionException(t);
        }
    case "properties":
        //swallow the properties and set them
        initProps(new KeyValueOption(value));
        return null;
    default:
        break;
    }
    throw new IllegalArgumentException(value);
}
 
Example #2
Source File: Options.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static Option<?> createOption(final OptionTemplate t, final String value) {
    switch (t.getType()) {
    case "string":
        // default value null
        return new Option<>(value);
    case "timezone":
        // default value "TimeZone.getDefault()"
        return new Option<>(TimeZone.getTimeZone(value));
    case "locale":
        return new Option<>(Locale.forLanguageTag(value));
    case "keyvalues":
        return new KeyValueOption(value);
    case "log":
        final KeyValueOption kv = new KeyValueOption(value);
        Logging.initialize(kv.getValues());
        return kv;
    case "boolean":
        return new Option<>(value != null && Boolean.parseBoolean(value));
    case "integer":
        try {
            return new Option<>((value == null) ? 0 : Integer.parseInt(value));
        } catch (final NumberFormatException nfe) {
            throw new IllegalOptionException(t);
        }
    case "properties":
        //swallow the properties and set them
        initProps(new KeyValueOption(value));
        return null;
    default:
        break;
    }
    throw new IllegalArgumentException(value);
}
 
Example #3
Source File: Options.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private static Option<?> createOption(final OptionTemplate t, final String value) {
    switch (t.getType()) {
    case "string":
        // default value null
        return new Option<>(value);
    case "timezone":
        // default value "TimeZone.getDefault()"
        return new Option<>(TimeZone.getTimeZone(value));
    case "locale":
        return new Option<>(Locale.forLanguageTag(value));
    case "keyvalues":
        return new KeyValueOption(value);
    case "log":
        final KeyValueOption kv = new KeyValueOption(value);
        Logging.initialize(kv.getValues());
        return kv;
    case "boolean":
        return new Option<>(value != null && Boolean.parseBoolean(value));
    case "integer":
        try {
            return new Option<>((value == null) ? 0 : Integer.parseInt(value));
        } catch (final NumberFormatException nfe) {
            throw new IllegalOptionException(t);
        }
    case "properties":
        //swallow the properties and set them
        initProps(new KeyValueOption(value));
        return null;
    default:
        break;
    }
    throw new IllegalArgumentException(value);
}