public interface IEnvPropUtil
Define common Environment and Properties operations
- Since:
- 1.0.0
- Version:
- 1.0.0
- Author:
- yui-KITAMURA
-
Method Summary
Modifier and TypeMethodDescriptionGet System Environment Value stored withkey
Get System Environment Value stored withkey
.Get properties value.Get properties value.void
Set properties value.boolean
setPropForce
(String key, String value) Set properties value.
-
Method Details
-
getEnv
Get System Environment Value stored withkey
- Parameters:
key
- system environment variables key- Returns:
- if exists, then that value, else
""(Empty string)
-
getEnv
Get System Environment Value stored withkey
. If not exists, then return thedefaultValue
- Parameters:
key
- system environment variables keydefaultValue
- default value when the variables not exists- Returns:
- if exists, then that value, else the
defaultValue
-
getProp
Get properties value.- Parameters:
key
- properties key- Returns:
- if exists, then that value, else
""(Empty string)
-
getProp
Get properties value. If not exists, then return thedefaultValue
- Parameters:
key
- properties keydefaultValue
- default value when the properties not exists- Returns:
- if exists, then that properties value, else the
defaultValue
-
setProp
@Contract("null,_ -> fail; _,null -> fail; _,_ -> _") void setProp(String key, String value) throws IllegalStateException Set properties value. If already exist, then throw exception.- Parameters:
key
- properties keyvalue
- set value- Throws:
IllegalStateException
- Already properties key-value set exists
-
setPropForce
@Contract("null,_ -> fail; _,null -> fail; _,_ -> _") boolean setPropForce(String key, String value) Set properties value. If already exist, then overwrite the value.- Parameters:
key
- properties keyvalue
- set value- Returns:
true
when overwrite
-