enthält, möchte ich die Liste von E-Mail-IDs erhalten, basierend auf zur Verfügung gestellt und filetype companyLesen Wiedergabe Anwendungskonfigurationsdatei verschachtelten Objekten
def getEmailAddresses(fileType: String, companyName: String): List[String] = {
val xz = Play.application.configuration.getConfigList("email_list")
println(xz)
}
meine obige Funktion mir einige komplexe Liste der Konfiguration ist zu geben, die nicht leicht überfahrbar ist.
Ich möchte grundsätzlich List[String]
, die nichts anderes als eine Liste von E-Mail-IDs ist.
Zum Beispiel gegebenen Argumente:
- filetype = test_2
- company = company2
Ich möchte String erhalten "[email protected], [email protected]"
, die List[String]
von .split(",").toList
umgewandelt werden können
Kann das vereinfacht werden?
finden meine application.conf Datei in scala Play Anwendung
email_list = [
{
file0 : "[email protected],[email protected]"
},
{
file1 : [
{"company1" : "[email protected]"},
{"company2" : "[email protected]"},
{"company3" : "[email protected]m"}
]
},
{
top2 = [
{"company1": "[email protected],[email protected]"},
{"company2": "[email protected],[email protected]"},
{"company3": "[email protected],[email protected]"}
]
},
{
test_2 = [
{"company1": "[email protected],[email protected]"},
{"company2": "[email protected],[email protected]"},
{"company3": "[email protected],[email protected]"}
]
},
{
xyz_7 = [
{"company1": "[email protected],[email protected]"},
{"company2": "[email protected],[email protected]"},
{"company3": "[email protected],[email protected]"}
]
},
{
abc_def = [
{"company1": "[email protected],[email protected]"},
{"company2": "[email protected],[email protected]"},
{"company3": "[email protected],[email protected]"}
]
}
]
Wenn Sie es von 'application.conf' lesen, warum strukturieren Sie es nicht auf eine einfachere Art und Weise, um gelesen/transversiert zu werden ?? – Salem
@Selem für bessere Lesbarkeit habe ich es basierend auf file_types modularisiert. – prasshant