Class TransmissionRiskLevelEncoding
- java.lang.Object
-
- app.coronawarn.server.services.distribution.config.TransmissionRiskLevelEncoding
-
- All Implemented Interfaces:
org.springframework.validation.Validator
@Configuration @Validated @ConfigurationProperties(prefix="transmission-risk-encoding") @PropertySource(value="classpath:master-config/transmission-risk-encoding.yaml", factory=YamlPropertySourceFactory.class) public class TransmissionRiskLevelEncoding extends Object implements org.springframework.validation.Validator
Wrapper over properties defined inmaster-config/tranmission-risk-encoding.yaml
. It provides convenience methods to derive properties from one another. Please see yaml file for more details on the reasoning / intent of encoding this field. This class also validates its own internal state at construction time as per Spring configuration class validation mechanisms.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TransmissionRiskLevelEncoding
from(Map<Integer,Integer> transmissionRiskLevelToDaysSinceSymptoms, Map<Integer,Integer> transmissionRiskLevelToReportType)
Constructs the configuration class from the given mappings.Integer
getDaysSinceSymptomsForTransmissionRiskLevel(Integer transmissionRiskLevel)
Returns a mapped ENF v2 Days Since Symptoms value for the given Transmission Risk Level or throws an exception if the TRL is not part of the mapping.ReportType
getReportTypeForTransmissionRiskLevel(Integer transmissionRiskLevel)
Returns a mapped ENF v2 Report Type value for the given Transmission Risk Level or throws an exception if the TRL is not part of the mapping.Map<Integer,Integer>
getTransmissionRiskToDaysSinceSymptoms()
Map<Integer,Integer>
getTransmissionRiskToReportType()
boolean
supports(Class<?> clazz)
void
validate(Object target, org.springframework.validation.Errors errors)
-
-
-
Method Detail
-
getDaysSinceSymptomsForTransmissionRiskLevel
public Integer getDaysSinceSymptomsForTransmissionRiskLevel(Integer transmissionRiskLevel)
Returns a mapped ENF v2 Days Since Symptoms value for the given Transmission Risk Level or throws an exception if the TRL is not part of the mapping.
-
getReportTypeForTransmissionRiskLevel
public ReportType getReportTypeForTransmissionRiskLevel(Integer transmissionRiskLevel)
Returns a mapped ENF v2 Report Type value for the given Transmission Risk Level or throws an exception if the TRL is not part of the mapping.
-
supports
public boolean supports(Class<?> clazz)
- Specified by:
supports
in interfaceorg.springframework.validation.Validator
-
validate
public void validate(Object target, org.springframework.validation.Errors errors)
- Specified by:
validate
in interfaceorg.springframework.validation.Validator
-
from
public static TransmissionRiskLevelEncoding from(Map<Integer,Integer> transmissionRiskLevelToDaysSinceSymptoms, Map<Integer,Integer> transmissionRiskLevelToReportType)
Constructs the configuration class from the given mappings.
-
getTransmissionRiskToDaysSinceSymptoms
public Map<Integer,Integer> getTransmissionRiskToDaysSinceSymptoms()
-
-