Skip to content

Instantly share code, notes, and snippets.

@msavy
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msavy/cc80ab47039010b7a9f1 to your computer and use it in GitHub Desktop.
Save msavy/cc80ab47039010b7a9f1 to your computer and use it in GitHub Desktop.
// First thing to note is that fields may be missing, and we need to provide a default.
// It would be nice to avoid intermediary null-check steps in this case.
// See also: https://github.com/jayway/JsonPath
"registry": {
"class": "io.apiman.gateway.engine.es.ESRegistry",
"config": {
"client.type": "jest",
"client.cluster-name": "elasticsearch_msavy",
"client.host": "localhost",
"client.port": "9201"
}
},
// Pseudo-code; get item at path, else default. No intermediary null checking necessary.
e.g. String clientType = apimanConfig("registry.config.client.type", String.class) || "transport";
@millross
Copy link

Optional clientType = apimanConfig("registry.config.client.type", String.class).orElse("transport") perhaps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment