com.swisscom.cloud.sb.broker.cfapi.converter.PlanDtoConverter.groovy Maven / Gradle / Ivy
package com.swisscom.cloud.sb.broker.cfapi.converter
import com.swisscom.cloud.sb.broker.cfapi.dto.PlanDto
import com.swisscom.cloud.sb.broker.converter.AbstractGenericConverter
import com.swisscom.cloud.sb.broker.model.Plan
import groovy.transform.CompileStatic
import org.springframework.stereotype.Component
import static MetadataJsonHelper.getValue
@Component
@CompileStatic
class PlanDtoConverter extends AbstractGenericConverter {
@Override
void convert(Plan source, PlanDto prototype) {
prototype.id = source.guid
prototype.name = source.name
prototype.description = source.description
prototype.free = source.free
prototype.metadata = convertMetadata(source)
}
private Map convertMetadata(Plan plan) {
Map result = [:]
plan.metadata.each { result[it.key] = getValue(it.type, it.value) }
result
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy