File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
src/main/java/org/radarbase/output/config Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -305,12 +305,12 @@ data class ResourceConfig(
305
305
val local : LocalConfig ? = null ,
306
306
val azure : AzureConfig ? = null ,
307
307
) {
308
- @JsonIgnore
309
- lateinit var sourceType: ResourceType
308
+ @get:JsonIgnore
309
+ val sourceType: ResourceType by lazy {
310
+ requireNotNull(type.toResourceType()) { " Unknown resource type $type , choose s3, hdfs or local" }
311
+ }
310
312
311
313
fun validate () {
312
- sourceType = type.toResourceType()
313
-
314
314
when (sourceType) {
315
315
ResourceType .S3 -> checkNotNull(s3) { " No S3 configuration provided." }
316
316
ResourceType .HDFS -> checkNotNull(hdfs) { " No HDFS configuration provided." }.also { it.validate() }
@@ -336,7 +336,7 @@ fun String.toResourceType() = when(toLowerCase()) {
336
336
" hdfs" -> ResourceType .HDFS
337
337
" local" -> ResourceType .LOCAL
338
338
" azure" -> ResourceType .AZURE
339
- else -> throw IllegalStateException ( " Unknown resource type $this , choose s3, hdfs or local " )
339
+ else -> null
340
340
}
341
341
342
342
data class LocalConfig (
You can’t perform that action at this time.
0 commit comments