Package org.cristalise.kernel.utils
Interface SystemPropertyOperations
- All Known Implementing Classes:
SystemProperties
public interface SystemPropertyOperations
Java enum type does not support inheritance. This interface provides implementations to handle
SystemProperties in a uniform way enabling modules to define their SystemProperties independently.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.slf4j.LoggerThis logger name is made unusual to avoid the problem when this interface is used in SystemProperty enums. -
Method Summary
Modifier and TypeMethodDescriptiondefault StringgetActualName(Object... nameArgs) Retrieve the actual name of the SystemProperty.default Booleandefault BooleangetBoolean(Boolean defaultOverwrite) default BooleangetBoolean(Boolean defaultOverwrite, Object... args) Retrieve the value of the SystemProperty as Boolean covering all the cases.default BooleangetBoolean(Object... args) Retrieve the value of the SystemProperty as Boolean for cases when the name of the SystemProperty is the combination of a predefined String and input string(s) required to configure the actual functionality.default ObjectgetInstance(Object... nameArgs) Retrieve the value of the SystemProperty as String and try to instantiate the resulting String usingClass.forName(String).default Integerdefault IntegergetInteger(Integer defaultOverwrite) default IntegergetInteger(Integer defaultOverwrite, Object... args) Retrieve the value of the SystemProperty as Integer covering all the cases.default IntegergetInteger(Object... args) Retrieve the value of the SystemProperty as Integer for cases when the name of the SystemProperty is the combination of a predefined String and input string(s) required to configure the actual functionality.default Objectdefault Objectdefault ObjectRetrieve the value of the SystemProperty as Object for cases when the name of the SystemProperty is the combination of a predefined String and input string(s) required to configure the actual functionality.default ObjectRetrieve the value of the SystemProperty as Object covering all the cases.default Stringdefault StringRetrieve the value of the SystemProperty as String (trimmed) for cases when the name of the SystemProperty is the combination of a predefined String and input string(s) required to configure the actual functionality.default Stringdefault StringRetrieve the value of the SystemProperty as String (trimmed) covering all the cases.default ObjectSet the value of the SystemProperty maintained.default Objectset(Properties props, Object value) Set the value in the given Properties object using the SystemProperty name.
-
Field Details
-
enumLogger
static final org.slf4j.Logger enumLoggerThis logger name is made unusual to avoid the problem when this interface is used in SystemProperty enums. When all the values of such SystemProperty is statically imported, the log variable will be imported as well. This will somehow supersede the log variable declared of the importing class.
-
-
Method Details
-
getSystemPropertyName
String getSystemPropertyName()- Returns:
- the String name of the SystemProperty, e.g. 'ItemServer.Telnet.host'
-
getDefaultValue
Object getDefaultValue()- Returns:
- the default value of the actual SystemPoperty, can be null.
-
getActualName
Retrieve the actual name of the SystemProperty. It is used for those SystemProperty names, which are based onString.format(String, Object...)- Parameters:
nameArgs- array of Strings to be used inString.format(String, Object...)to retrieve the actual name of the SystemProperty- Returns:
- actual name of the SystemProperty
-
getObject
- Returns:
- the value of the SystemProperty as Object. If no value is provided return the configured default value if available otherwise return null.
-
getObject
- Parameters:
defaultOverwrite- Use this value as default. Overwrites the default value defined in the enum. Can be null.- Returns:
- the value of the SystemProperty as Object. If no value is provided return the provided default value or configured default value if available otherwise return null
-
getObject
Retrieve the value of the SystemProperty as Object for cases when the name of the SystemProperty is the combination of a predefined String and input string(s) required to configure the actual functionality.
To support this the SystemProperty name is based onString.format(String, Object...)i.e. it contains string like 'OutcomeInit.%s'.- Parameters:
nameArgs- array of Strings to be used inString.format(String, Object...). to retrieve the actual name of the SystemProperty. Can be null.- Returns:
- the value of the SystemProperty as Object. If no value is provided return configured default value if available otherwise return null
-
getObject
Retrieve the value of the SystemProperty as Object covering all the cases. It can retrieve the value associated with the SystemProperty name or it can retrieve the value when the name of the SystemProperty is the combination of a predefined String and input string(s) required to configure the actual functionality.
To support this the SystemProperty name is based onString.format(String, Object...)i.e. it contains string like 'OutcomeInit.%s'.- Parameters:
defaultOverwrite- Use this value as default. Overwrites the default value defined in the enum. Can be null.nameArgs- array of Strings to be used inString.format(String, Object...)to retrieve the actual name of the SystemProperty. Can be null.- Returns:
- the value of the SystemProperty as Object. If no value is provided return configured default value if available otherwise return null
-
getString
- Returns:
- the value of the SystemProperty as String (trimmed). If no value is provided return the configured default value if available otherwise return null.
-
getString
- Parameters:
defaultOverwrite- Use this value as default. Overwrites the default value defined in the enum. Can be null.- Returns:
- the value of the SystemProperty as String (trimmed). If no value is provided return the provided default value or configured default value if available otherwise return null.
-
getString
Retrieve the value of the SystemProperty as String (trimmed) for cases when the name of the SystemProperty is the combination of a predefined String and input string(s) required to configure the actual functionality.
To support this the SystemProperty name is based onString.format(String, Object...)i.e. it contains string like 'OutcomeInit.%s'.- Parameters:
nameArgs- array of Strings to be used inString.format(String, Object...). to retrieve the actual name of the SystemProperty. Can be null.- Returns:
- the value of the SystemProperty as String (trimmed). If no value is provided return configured default value if available otherwise return null
-
getString
Retrieve the value of the SystemProperty as String (trimmed) covering all the cases. It can retrieve the value associated with the SystemProperty name or it can retrieve the value when the name of the SystemProperty is the combination of a predefined String and input string(s) required to configure the actual functionality.
To support this the SystemProperty name is based onString.format(String, Object...)i.e. it contains string like 'OutcomeInit.%s'.- Parameters:
defaultOverwrite- Use this value as default. Overwrites the default value defined in the enum. Can be null.nameArgs- array of Strings to be used inString.format(String, Object...)to retrieve the actual name of the SystemProperty. Can be null.- Returns:
- the value of the SystemProperty as String (trimmed). If no value is provided return configured default value if available otherwise return null.
-
getInteger
- Returns:
- the value of the SystemProperty as Integer. If no value is provided return the configured default value if available otherwise return null.
-
getInteger
- Parameters:
defaultOverwrite- Use this value as default. Overwrites the default value defined in the enum- Returns:
- the value of the SystemProperty as Integer. If no value is provided return the provided default value or configured default value if available otherwise return null.
-
getInteger
Retrieve the value of the SystemProperty as Integer for cases when the name of the SystemProperty is the combination of a predefined String and input string(s) required to configure the actual functionality.
To support this the SystemProperty name is based onString.format(String, Object...)i.e. it contains string like 'OutcomeInit.%s'.- Parameters:
nameArgs- array of Strings to be used inString.format(String, Object...). to retrieve the actual name of the SystemProperty. Can be null.- Returns:
- the value of the SystemProperty as Integer. If no value is provided return configured default value if available otherwise return null
-
getInteger
Retrieve the value of the SystemProperty as Integer covering all the cases. It can retrieve the value associated with the SystemProperty name or it can retrieve the value when the name of the SystemProperty is the combination of a predefined String and input string(s) required to configure the actual functionality.
To support this the SystemProperty name is based onString.format(String, Object...)i.e. it contains string like 'OutcomeInit.%s'.- Parameters:
defaultOverwrite- Use this value as default. Overwrites the default value defined in the enum. Can be null.nameArgs- array of Strings to be used inString.format(String, Object...)to retrieve the actual name of the SystemProperty. Can be null.- Returns:
- the value of the SystemProperty as Integer. If no value is provided return configured default value if available otherwise return null
-
getBoolean
- Returns:
- the value of the SystemProperty as Boolean. If no value is provided return the configured default value if available otherwise return null.
-
getBoolean
- Parameters:
defaultOverwrite- Use this value as default. Overwrites the default value defined in the enum- Returns:
- the value of the SystemProperty as Boolean. If no value is provided return the provided default value or configured default value if available otherwise return null.
-
getBoolean
Retrieve the value of the SystemProperty as Boolean for cases when the name of the SystemProperty is the combination of a predefined String and input string(s) required to configure the actual functionality.
To support this the SystemProperty name is based onString.format(String, Object...)i.e. it contains string like 'OutcomeInit.%s'.- Parameters:
nameArgs- array of Strings to be used inString.format(String, Object...). to retrieve the actual name of the SystemProperty. Can be null.- Returns:
- the value of the SystemProperty as Boolean. If no value is provided return configured default value if available otherwise return null
-
getBoolean
Retrieve the value of the SystemProperty as Boolean covering all the cases. It can retrieve the value associated with the SystemProperty name or it can retrieve the value when the name of the SystemProperty is the combination of a predefined String and input string(s) required to configure the actual functionality.
To support this the SystemProperty name is based onString.format(String, Object...)i.e. it contains string like 'OutcomeInit.%s'.- Parameters:
defaultOverwrite- Use this value as default. Overwrites the default value defined in the enum. Can be null.nameArgs- array of Strings to be used inString.format(String, Object...)to retrieve the actual name of the SystemProperty. Can be null.- Returns:
- the value of the SystemProperty as Boolean. If no value is provided return configured default value if available otherwise return null
-
getInstance
Retrieve the value of the SystemProperty as String and try to instantiate the resulting String usingClass.forName(String). It covers cases when the name of the SystemProperty is the combination of a predefined String and input string(s) required to configure the actual functionality.
To support this the SystemProperty name is based onString.format(String, Object...)i.e. it contains string like 'OutcomeInit.%s'.- Parameters:
nameArgs- array of Strings to be used inString.format(String, Object...). to retrieve the actual name of the SystemProperty. Can be null.- Returns:
- the value of the SystemProperty as in instance of the Class.
- Throws:
ReflectiveOperationException- No value was available for the SystemProperty.
-
set
Set the value of the SystemProperty maintained.- Parameters:
value- of the SystemProperty- Returns:
- the previous value associated with SystemProperty, or null if there was no mapping for SystemProperty.
-
set
Set the value in the given Properties object using the SystemProperty name.- Parameters:
props- the properties object to be updatedvalue- of the SystemProperty- Returns:
- the previous value associated with SystemProperty, or null if there was no mapping for SystemProperty.
-