Package com.helger.base.rt
Class PropertiesHelper
java.lang.Object
com.helger.base.rt.PropertiesHelper
Helper class to ease the use of
Properties class.- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable StringexpandProperties(@Nullable String sValue, @NonNull UnaryOperator<String> aValueProvider) Special version ofexpandSystemProperties(String)that takes an arbitrary value provider and is not limited to system properties.static @Nullable StringexpandSystemProperties(@Nullable String sValue) Copy of Oracle internal PropertyExpander.expand methodgetAsStringMap(@NonNull Properties aProps) Convert the passedPropertiesobject to a simpleMapwith String keys and String values.static @Nullable NonBlockingPropertiesloadProperties(@NonNull InputStream aIS) Load properties from the given input stream.static @Nullable NonBlockingPropertiesloadProperties(@NonNull Reader aReader) Load properties from the given reader.
-
Method Details
-
getAsStringMap
@ReturnsMutableCopy public static @NonNull Map<String,String> getAsStringMap(@NonNull Properties aProps) Convert the passedPropertiesobject to a simpleMapwith String keys and String values.- Parameters:
aProps- The properties to convert. May not benull.- Returns:
- A new mutable map with all entries. Never
null.
-
loadProperties
Load properties from the given input stream.- Parameters:
aIS- The input stream to read from. May not benull. Will be closed.- Returns:
- The loaded properties or
nullif loading failed.
-
loadProperties
Load properties from the given reader.- Parameters:
aReader- The reader to read from. May not benull. Will be closed.- Returns:
- The loaded properties or
nullif loading failed.
-
expandSystemProperties
Copy of Oracle internal PropertyExpander.expand method- Parameters:
sValue- Source value. May benull.- Returns:
nullif source isnull.- See Also:
-
expandProperties
public static @Nullable String expandProperties(@Nullable String sValue, @NonNull UnaryOperator<String> aValueProvider) Special version ofexpandSystemProperties(String)that takes an arbitrary value provider and is not limited to system properties.- Parameters:
sValue- Source value. May benull.aValueProvider- The value provider to be used. May not benull.- Returns:
nullif the source value isnull.- Since:
- 9.1.2
-