Class PropertiesIO
java.lang.Object
cz.zcu.fav.kiv.mjakubas.saf.io.properties.PropertiesIO
I/O methods working with '.properties' files loaded as
Properties
class.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FileType
getFileTypeValue
(@NotNull Properties properties, @NotNull String value) Gets property value ofFileType
command id it exists.static Properties
getProperties
(String propertiesPath) ReturnsProperties
instance representing loaded properties file.static String
getValue
(@NotNull Properties properties, @NotNull String key) Gets property value by its key if it exists.
-
Constructor Details
-
PropertiesIO
public PropertiesIO()
-
-
Method Details
-
getValue
public static String getValue(@NotNull @NotNull Properties properties, @NotNull @NotNull String key) throws IOException Gets property value by its key if it exists. Otherwise, throwsIOException
.- Parameters:
properties
-Properties
classkey
- property key- Returns:
- property value
- Throws:
IOException
- if property key doesn't exist
-
getFileTypeValue
public static FileType getFileTypeValue(@NotNull @NotNull Properties properties, @NotNull @NotNull String value) throws MissingPropertyKeyException Gets property value ofFileType
command id it exists. Otherwise, throwsMissingPropertyKeyException
.- Parameters:
properties
- {Properties
class}value
- property value- Returns:
- property
FileType
- Throws:
MissingPropertyKeyException
- if property value doesn't exist
-
getProperties
ReturnsProperties
instance representing loaded properties file.- Parameters:
propertiesPath
- properties file path- Returns:
Properties
instance- Throws:
NullPointerException
- if any parameter is nullIOException
- in any I/O exception occurs
-