|
|
|
@ -42,7 +42,7 @@ import org.springframework.util.Assert;
@@ -42,7 +42,7 @@ import org.springframework.util.Assert;
|
|
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Base class for Yaml factories. |
|
|
|
|
* Base class for YAML factories. |
|
|
|
|
* |
|
|
|
|
* @author Dave Syer |
|
|
|
|
* @since 4.1 |
|
|
|
@ -65,7 +65,6 @@ public abstract class YamlProcessor {
@@ -65,7 +65,6 @@ public abstract class YamlProcessor {
|
|
|
|
|
* some of the documents in a YAML resource. In YAML documents are |
|
|
|
|
* separated by <code>---<code> lines, and each document is converted |
|
|
|
|
* to properties before the match is made. E.g. |
|
|
|
|
* |
|
|
|
|
* <pre class="code"> |
|
|
|
|
* environment: dev |
|
|
|
|
* url: http://dev.bar.com
|
|
|
|
@ -75,11 +74,9 @@ public abstract class YamlProcessor {
@@ -75,11 +74,9 @@ public abstract class YamlProcessor {
|
|
|
|
|
* url:http://foo.bar.com
|
|
|
|
|
* name: My Cool App |
|
|
|
|
* </pre> |
|
|
|
|
* |
|
|
|
|
* when mapped with |
|
|
|
|
* <code>documentMatchers = YamlProcessor.mapMatcher({"environment": "prod"})</code> |
|
|
|
|
* would end up as |
|
|
|
|
* |
|
|
|
|
* <pre class="code"> |
|
|
|
|
* environment=prod |
|
|
|
|
* url=http://foo.bar.com
|
|
|
|
@ -103,9 +100,9 @@ public abstract class YamlProcessor {
@@ -103,9 +100,9 @@ public abstract class YamlProcessor {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Method to use for resolving resources. Each resource will be converted to a Map, so |
|
|
|
|
* this property is used to decide which map entries to keep in the final output from |
|
|
|
|
* this factory. |
|
|
|
|
* Method to use for resolving resources. Each resource will be converted to a Map, |
|
|
|
|
* so this property is used to decide which map entries to keep in the final output |
|
|
|
|
* from this factory. |
|
|
|
|
* @param resolutionMethod the resolution method to set (defaults to |
|
|
|
|
* {@link ResolutionMethod#OVERRIDE}). |
|
|
|
|
*/ |
|
|
|
@ -127,9 +124,9 @@ public abstract class YamlProcessor {
@@ -127,9 +124,9 @@ public abstract class YamlProcessor {
|
|
|
|
|
* Provide an opportunity for subclasses to process the Yaml parsed from the supplied |
|
|
|
|
* resources. Each resource is parsed in turn and the documents inside checked against |
|
|
|
|
* the {@link #setDocumentMatchers(DocumentMatcher...) matchers}. If a document |
|
|
|
|
* matches it is passed into the callback, along with its representation as |
|
|
|
|
* Properties. Depending on the {@link #setResolutionMethod(ResolutionMethod)} not all |
|
|
|
|
* of the documents will be parsed. |
|
|
|
|
* matches it is passed into the callback, along with its representation as Properties. |
|
|
|
|
* Depending on the {@link #setResolutionMethod(ResolutionMethod)} not all of the |
|
|
|
|
* documents will be parsed. |
|
|
|
|
* @param callback a callback to delegate to once matching documents are found |
|
|
|
|
* @see #createYaml() |
|
|
|
|
*/ |
|
|
|
@ -393,6 +390,11 @@ public abstract class YamlProcessor {
@@ -393,6 +390,11 @@ public abstract class YamlProcessor {
|
|
|
|
|
*/ |
|
|
|
|
protected static class StrictMapAppenderConstructor extends Constructor { |
|
|
|
|
|
|
|
|
|
// Declared as public for use in subclasses
|
|
|
|
|
public StrictMapAppenderConstructor() { |
|
|
|
|
super(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected Map<Object, Object> constructMapping(MappingNode node) { |
|
|
|
|
try { |
|
|
|
@ -421,7 +423,6 @@ public abstract class YamlProcessor {
@@ -421,7 +423,6 @@ public abstract class YamlProcessor {
|
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|