ttomcat-1778514358873.zip-extract/_dependencies/maven/com.h2database_h2-2.2.220/org/h2/engine/SettingsBase.java

Path
ttomcat-1778514358873.zip-extract/_dependencies/maven/com.h2database_h2-2.2.220/org/h2/engine/SettingsBase.java
Status
scanned
Type
file
Name
SettingsBase.java
Extension
.java
Programming language
Java
Mime type
text/x-java
File type
Java source, ASCII text
Tag

      
    
Rootfs path

      
    
Size
3654 (3.6 KB)
MD5
3e507ef03af0efbc9d447af3817de0be
SHA1
4871b7c2ad52e23d078eeb6aa1839c09a603994a
SHA256
c15b824833777e174f0dddf18c4e9bd73a4f96e542405cd00b3986f2eea4571a
SHA512

      
    
SHA1_git
0b0ace05a64207384e279881125dc74cac23e799
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
SettingsBase.java | 3.6 KB |

/* * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, * and the EPL 1.0 (https://h2database.com/html/license.html). * Initial Developer: H2 Group */ package org.h2.engine; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import org.h2.api.ErrorCode; import org.h2.message.DbException; import org.h2.util.Utils; /** * The base class for settings. */ public class SettingsBase { private final HashMap<String, String> settings; protected SettingsBase(HashMap<String, String> s) { this.settings = s; } /** * Get the setting for the given key. * * @param key the key * @param defaultValue the default value * @return the setting */ protected boolean get(String key, boolean defaultValue) { String s = get(key, Boolean.toString(defaultValue)); try { return Utils.parseBoolean(s, defaultValue, true); } catch (IllegalArgumentException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, "key:" + key + " value:" + s); } } /** * Set an entry in the key-value pair. * * @param key the key * @param value the value */ void set(String key, boolean value) { settings.put(key, Boolean.toString(value)); } /** * Get the setting for the given key. * * @param key the key * @param defaultValue the default value * @return the setting */ protected int get(String key, int defaultValue) { String s = get(key, Integer.toString(defaultValue)); try { return Integer.decode(s); } catch (NumberFormatException e) { throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, "key:" + key + " value:" + s); } } /** * Get the setting for the given key. * * @param key the key * @param defaultValue the default value * @return the setting */ protected String get(String key, String defaultValue) { String v = settings.get(key); if (v != null) { return v; } StringBuilder buff = new StringBuilder("h2."); boolean nextUpper = false; for (int i = 0, l = key.length(); i < l; i++) { char c = key.charAt(i); if (c == '_') { nextUpper = true; } else { // Character.toUpperCase / toLowerCase ignores the locale buff.append(nextUpper ? Character.toUpperCase(c) : Character.toLowerCase(c)); nextUpper = false; } } String sysProperty = buff.toString(); v = Utils.getProperty(sysProperty, defaultValue); settings.put(key, v); return v; } /** * Check if the settings contains the given key. * * @param k the key * @return true if they do */ protected boolean containsKey(String k) { return settings.containsKey(k); } /** * Get all settings. * * @return the settings */ public HashMap<String, String> getSettings() { return settings; } /** * Get all settings in alphabetical order. * * @return the settings */ public Entry<String, String>[] getSortedSettings() { @SuppressWarnings("unchecked") Map.Entry<String, String>[] entries = settings.entrySet().toArray(new Map.Entry[0]); Arrays.sort(entries, Comparator.comparing(Entry::getKey)); return entries; } }
Detected license expression

      
    
Detected license expression (SPDX)

      
    
Percentage of license text
2.81
Copyrights
- end_line: 2
  copyright: Copyright 2004-2023 H2 Group. Multiple-Licensed
  start_line: 2
Holders
- holder: H2 Group. Multiple-Licensed
  end_line: 2
  start_line: 2
Authors

      
    
License expression License clue details
(mpl-2.0 OR epl-1.0) AND proprietary-license {'score': 20.37, 'matcher': '3-seq', 'end_line': 3, 'rule_url': 'https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mpl-2.0_or_epl-1.0_and_proprietary-license_2.RULE', 'from_file': None, 'start_line': 2, 'matched_text': ' * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0,\n * and the EPL 1.0 (https://h2database.com/html/license.html).', 'match_coverage': 20.37, 'matched_length': 11, 'rule_relevance': 100, 'rule_identifier': 'mpl-2.0_or_epl-1.0_and_proprietary-license_2.RULE', 'license_expression': '(mpl-2.0 OR epl-1.0) AND proprietary-license', 'license_expression_spdx': '(MPL-2.0 OR EPL-1.0) AND LicenseRef-scancode-proprietary-license'}
URL Start line End line
https://h2database.com/html/license.html 3 3
Package URL License Primary language
pkg:osgi/com.h2database.source@2.2.220