application:
variables:
API_KEY: /secrets/gsaccount/gsaccount
DB_GCP_PROJECT:
abc-foo: [dev, uat]
abc-bar: [staging, prod]
public class EnvironmentVariable { private String value; private Map<String, List<String>> possibleValues;
public EnvironmentVariable(String value) { this.value = value; }
public EnvironmentVariable(Map<String, List<String>> value) { this.possibleValues = value; }
public String getValue() { // Will handle logic to decide what to return here }}
public class Application { private Map<String, EnvironmentVariable> variables;
public Map<String, EnvironmentVariable> getVariables() { return variables; }
public void setVariables(Map<String, EnvironmentVariable> environmentVariables) { this.variables = environmentVariables; }}
java.lang.InstantiationException: NoSuchMethodException:org.cogeco.models.manifest.EnvironmentVariable.<init>() in 'reader', line 7, column 5: SIMPLE: foo ^
...
Right now, SnakeYAML will fail when loading the given YAML with the following error:
java.lang.InstantiationException: NoSuchMethodException:org.cogeco.models.manifest.EnvironmentVariable.<init>()in 'reader', line 7, column 5:SIMPLE: foo^
java.lang.InstantiationException: NoSuchMethodException:org.cogeco.models.manifest.EnvironmentVariable.<init>() in 'reader', line 7, column 5:
API_KEY: /secrets/gsaccount/gsaccount ^
--
You received this message because you are subscribed to the Google Groups "SnakeYAML" group.
To unsubscribe from this group and stop receiving emails from it, send an email to snakeyaml-cor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/snakeyaml-core/cdf84b37-cb30-4e4b-be0c-45323e871c80o%40googlegroups.com.
Cannot create property=application for JavaBean=org.cogeco.models.manifest.Manifest@77c2494c in 'reader', line 1, column 1: version: 1 ^Cannot create property=environment_variables for JavaBean=org.cogeco.models.manifest.Application@477b4cdf in 'reader', line 4, column 3: name: Foobar ^Cannot create property=abc-foo for JavaBean=org.cogeco.models.manifest.EnvironmentVariable@3eb25e1a in 'reader', line 9, column 7: abc-foo: [dev, uat] ^Unable to find property 'abc-foo' on class: org.cogeco.models.manifest.EnvironmentVariable in 'reader', line 9, column 16: abc-foo: [dev, uat] ^
in 'reader', line 7, column 5:
API_KEY: /secrets/gsaccount/gsac ... ^
in 'reader', line 4, column 3: name: Foobar ^
--
You received this message because you are subscribed to the Google Groups "SnakeYAML" group.
To unsubscribe from this group and stop receiving emails from it, send an email to snakeyaml-cor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/snakeyaml-core/f4554cc1-9fa8-4c52-8028-9eedbf136822o%40googlegroups.com.
application: variables: API_KEY: /secrets/gsaccount/gsaccount DB_GCP_PROJECT: abc-foo: [dev, uat] abc-bar: [staging, prod]
I hope this is not turning into a Java Class :-)Nothing to do with SnakeYAML.I love Baeldung's website.Try their code. It just works!
To unsubscribe from this group and stop receiving emails from it, send an email to snakeya...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to snakeyaml-cor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/snakeyaml-core/e69aac85-c9c9-463f-9f47-71e84c97e69bo%40googlegroups.com.
In java .. "Map<String, Object>" is NOT the same as "Map<String, List<String>>" or "Map<String, EnvironmentVariable>".
So, recommend you replace the latter 2 Map<> definitions .. with the 1st one.
People coming from Python/JS world are in for a shock with the precision required in Java-code