tysonnorris commented on a change in pull request #2650: Apply standard scala
formatting.
URL:
https://github.com/apache/incubator-openwhisk/pull/2650#discussion_r134609158
##########
File path: common/scala/src/main/scala/whisk/common/Config.scala
##########
@@ -42,113 +42,120 @@ import scala.util.Try
* @param optionalProperties a Set of optional properties which may or not be
defined.
* @param env an optional environment to read from (defaults to sys.env).
*/
-class Config(
- requiredProperties: Map[String, String],
- optionalProperties: Set[String] = Set())(
- env: Map[String, String] = sys.env)(
- implicit logging: Logging) {
-
- private val settings = getProperties().toMap.filter {
- case (k, v) => requiredProperties.contains(k) ||
- (optionalProperties.contains(k) && v != null)
- }
+class Config(requiredProperties: Map[String, String], optionalProperties:
Set[String] = Set())(
+ env: Map[String, String] = sys.env)(implicit logging: Logging) {
- lazy val isValid: Boolean = Config.validateProperties(requiredProperties,
settings)
-
- /**
- * Gets value for key if it exists else the empty string.
- * The value of the override key will instead be returned if its value is
present in the map.
- *
- * @param key to lookup
- * @param overrideKey the property whose value will be returned if the map
contains the override key.
- * @return value for the key or the empty string if the key does not have
a value/does not exist
- */
- def apply(key: String, overrideKey: String = ""): String = {
- Try(settings(overrideKey)).orElse(Try(settings(key))).getOrElse("")
- }
+ private val settings = getProperties().toMap.filter {
+ case (k, v) =>
+ requiredProperties.contains(k) ||
+ (optionalProperties.contains(k) && v != null)
+ }
- /**
- * Returns the value of a given key.
- *
- * @param key the property that has to be returned.
- */
- def getProperty(key: String): String = {
- this(key)
- }
+ lazy val isValid: Boolean =
+ Config.validateProperties(requiredProperties, settings)
Review comment:
+1
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services