@@ -1551,12 +1551,32 @@ public static String getAwtToolkit() {
15511551 return getProperty (AWT_TOOLKIT );
15521552 }
15531553
1554+ /**
1555+ * Gets the current value for the property named {@code "SimpleClassName.Key"} as a {@code boolean}.
1556+ * <p>
1557+ * If a {@link SecurityException} is caught, the return value is {@code null}.
1558+ * </p>
1559+ *
1560+ * @param clazz The Class to use for the SimpleClassName.
1561+ * @param key The subkey.
1562+ * @param defaultIfAbsent The default value.
1563+ * @return an int or defaultIfAbsent.
1564+ * @see Class#getSimpleName()
1565+ * @since 3.19.0
1566+ */
1567+ public static boolean getBoolean (final Class <?> clazz , final String key , final BooleanSupplier defaultIfAbsent ) {
1568+ return getBoolean (toKey (clazz , key , true ), defaultIfAbsent );
1569+ }
1570+
15541571 /**
15551572 * Gets the current value for the property named {@code key} as an {@code boolean}.
1573+ * <p>
1574+ * If a {@link SecurityException} is caught, the return value is {@code null}.
1575+ * </p>
15561576 *
1557- * @param key The key
1558- * @param defaultIfAbsent The default value
1559- * @return an {@code boolean} or defaultIfAbsent
1577+ * @param key The key.
1578+ * @param defaultIfAbsent The default value.
1579+ * @return an {@code boolean} or defaultIfAbsent.
15601580 */
15611581 public static boolean getBoolean (final String key , final BooleanSupplier defaultIfAbsent ) {
15621582 final String str = getProperty (key );
@@ -1863,12 +1883,32 @@ public static String getHttpsProxyPort() {
18631883 return getProperty (HTTPS_PROXY_PORT );
18641884 }
18651885
1886+ /**
1887+ * Gets the current value for the property named {@code "SimpleClassName.Key"} as an {@code int}.
1888+ * <p>
1889+ * If a {@link SecurityException} is caught, the return value is {@code null}.
1890+ * </p>
1891+ *
1892+ * @param clazz The Class to use for the SimpleClassName.
1893+ * @param key The subkey.
1894+ * @param defaultIfAbsent The default value.
1895+ * @return an int or defaultIfAbsent.
1896+ * @see Class#getSimpleName()
1897+ * @since 3.19.0
1898+ */
1899+ public static int getInt (final Class <?> clazz , final String key , final IntSupplier defaultIfAbsent ) {
1900+ return getInt (toKey (clazz , key , true ), defaultIfAbsent );
1901+ }
1902+
18661903 /**
18671904 * Gets the current value for the property named {@code key} as an {@code int}.
1905+ * <p>
1906+ * If a {@link SecurityException} is caught, the return value is {@code null}.
1907+ * </p>
18681908 *
1869- * @param key The key
1870- * @param defaultIfAbsent The default value
1871- * @return an {@code int} or defaultIfAbsent
1909+ * @param key The key.
1910+ * @param defaultIfAbsent The default value.
1911+ * @return an {@code int} or defaultIfAbsent.
18721912 */
18731913 public static int getInt (final String key , final IntSupplier defaultIfAbsent ) {
18741914 final String str = getProperty (key );
@@ -3579,12 +3619,32 @@ public static String getLineSeparator(final Supplier<String> defaultIfAbsent) {
35793619 return getProperty (LINE_SEPARATOR , defaultIfAbsent );
35803620 }
35813621
3622+ /**
3623+ * Gets the current value for the property named {@code "SimpleClassName.Key"} as a {@code long}.
3624+ * <p>
3625+ * If a {@link SecurityException} is caught, the return value is {@code null}.
3626+ * </p>
3627+ *
3628+ * @param clazz The Class to use for the SimpleClassName.
3629+ * @param key The subkey.
3630+ * @param defaultIfAbsent The default value.
3631+ * @return a long or defaultIfAbsent.
3632+ * @see Class#getSimpleName()
3633+ * @since 3.19.0
3634+ */
3635+ public static long getLong (final Class <?> clazz , final String key , final LongSupplier defaultIfAbsent ) {
3636+ return getLong (toKey (clazz , key , true ), defaultIfAbsent );
3637+ }
3638+
35823639 /**
35833640 * Gets the current value for the property named {@code key} as a {@code long}.
3641+ * <p>
3642+ * If a {@link SecurityException} is caught, the return value is {@code null}.
3643+ * </p>
35843644 *
3585- * @param key The key
3586- * @param defaultIfAbsent The default value
3587- * @return a {@code long} or defaultIfAbsent
3645+ * @param key The key.
3646+ * @param defaultIfAbsent The default value.
3647+ * @return a {@code long} or defaultIfAbsent.
35883648 */
35893649 public static long getLong (final String key , final LongSupplier defaultIfAbsent ) {
35903650 final String str = getProperty (key );
@@ -4093,6 +4153,10 @@ public static boolean isPropertySet(final String property) {
40934153 return getProperty (property ) != null ;
40944154 }
40954155
4156+ private static String toKey (final Class <?> clazz , final String key , final boolean simpleKey ) {
4157+ return ClassUtils .getName (clazz , StringUtils .EMPTY , simpleKey ) + "." + key ;
4158+ }
4159+
40964160 /**
40974161 * Make private in 4.0.
40984162 *
0 commit comments