Skip to content

Commit

Permalink
Kotlin implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkokar committed Jun 11, 2019
1 parent 0dfd928 commit 04189e5
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 199 deletions.
5 changes: 5 additions & 0 deletions components/proxy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
<artifactId>jackson-dataformat-yaml</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
</dependency>

<dependency>
<artifactId>logback-classic</artifactId>
<groupId>ch.qos.logback</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import com.fasterxml.jackson.module.kotlin.KotlinModule;
import com.hotels.styx.api.configuration.ConversionException;
import com.hotels.styx.api.configuration.Configuration;

Expand All @@ -38,7 +39,9 @@
* jackson API and Styx API.
*/
public class JsonNodeConfig implements Configuration {
static final ObjectMapper YAML_MAPPER = addStyxMixins(new ObjectMapper(new YAMLFactory()))
static final ObjectMapper YAML_MAPPER = addStyxMixins(
new ObjectMapper(new YAMLFactory())
.registerModule(new KotlinModule()))
.configure(FAIL_ON_UNKNOWN_PROPERTIES, false)
.configure(AUTO_CLOSE_SOURCE, true);

Expand All @@ -58,7 +61,7 @@ public JsonNodeConfig(JsonNode rootNode) {
* Construct an instance from a JSON node.
*
* @param rootNode a JSON node
* @param mapper mapper to convert JSON into objects
* @param mapper mapper to convert JSON into objects
*/
protected JsonNodeConfig(JsonNode rootNode, ObjectMapper mapper) {
this.rootNode = requireNonNull(rootNode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public class RoutingObjectFactory {
.put(PROXY_TO_BACKEND, ProxyToBackend.SCHEMA)
.put(PATH_PREFIX_ROUTER, PathPrefixRouter.SCHEMA)
.put(HOST_PROXY, HostProxy.SCHEMA)
.put(LOAD_BALANCING_GROUP, LoadBalancingGroup.SCHEMA)
.put(LOAD_BALANCING_GROUP, LoadBalancingGroup.Companion.getSCHEMA())
.build();
}

Expand Down

This file was deleted.

Loading

0 comments on commit 04189e5

Please sign in to comment.