health check now entirely config based
[so.git] / mso-api-handlers / mso-api-handler-infra / src / main / java / org / onap / so / apihandlerinfra / HealthCheckConverter.java
1 package org.onap.so.apihandlerinfra;
2
3 import java.net.URI;
4 import javax.ws.rs.core.UriBuilder;
5 import org.springframework.core.convert.TypeDescriptor;
6 import org.springframework.stereotype.Component;
7
8 @Component
9 public class HealthCheckConverter {
10
11
12     public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
13         if (sourceType.getType() == String.class && targetType.getType() == Subsystem.class) {
14             return SoSubsystems.valueOf(((String) source).toUpperCase());
15         } else if (sourceType.getType() == String.class && targetType.getType() == URI.class) {
16             return UriBuilder.fromUri((String) source).build();
17         } else {
18             return source;
19         }
20     }
21
22 }