org.apache.flink.shaded.jackson2.com.fasterxml.jackson.dataformat.yaml.YAMLFactory Java Examples

The following examples show how to use org.apache.flink.shaded.jackson2.com.fasterxml.jackson.dataformat.yaml.YAMLFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConfigUtil.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public LowerCaseYamlMapper() {
	super(new YAMLFactory() {
		@Override
		protected YAMLParser _createParser(InputStream in, IOContext ctxt) throws IOException {
			final Reader r = _createReader(in, null, ctxt);
			// normalize all key to lower case keys
			return new YAMLParser(ctxt, _getBufferRecycler(), _parserFeatures, _yamlParserFeatures, _objectCodec, r) {
				@Override
				public String getCurrentName() throws IOException {
					if (_currToken == JsonToken.FIELD_NAME) {
						return _currentFieldName.toLowerCase();
					}
					return super.getCurrentName();
				}

				@Override
				public String getText() throws IOException {
					if (_currToken == JsonToken.FIELD_NAME) {
						return _currentFieldName.toLowerCase();
					}
					return super.getText();
				}
			};
		}
	});
}
 
Example #2
Source File: ConfigUtil.java    From flink with Apache License 2.0 6 votes vote down vote up
public LowerCaseYamlMapper() {
	super(new YAMLFactory() {
		@Override
		protected YAMLParser _createParser(InputStream in, IOContext ctxt) throws IOException {
			final Reader r = _createReader(in, null, ctxt);
			// normalize all key to lower case keys
			return new YAMLParser(ctxt, _getBufferRecycler(), _parserFeatures, _yamlParserFeatures, _objectCodec, r) {
				@Override
				public String getCurrentName() throws IOException {
					if (_currToken == JsonToken.FIELD_NAME) {
						return _currentFieldName.toLowerCase();
					}
					return super.getCurrentName();
				}

				@Override
				public String getText() throws IOException {
					if (_currToken == JsonToken.FIELD_NAME) {
						return _currentFieldName.toLowerCase();
					}
					return super.getText();
				}
			};
		}
	});
}
 
Example #3
Source File: ConfigUtil.java    From flink with Apache License 2.0 6 votes vote down vote up
public LowerCaseYamlMapper() {
	super(new YAMLFactory() {
		@Override
		protected YAMLParser _createParser(InputStream in, IOContext ctxt) throws IOException {
			final Reader r = _createReader(in, null, ctxt);
			// normalize all key to lower case keys
			return new YAMLParser(ctxt, _getBufferRecycler(), _parserFeatures, _yamlParserFeatures, _objectCodec, r) {
				@Override
				public String getCurrentName() throws IOException {
					if (_currToken == JsonToken.FIELD_NAME) {
						return _currentFieldName.toLowerCase();
					}
					return super.getCurrentName();
				}

				@Override
				public String getText() throws IOException {
					if (_currToken == JsonToken.FIELD_NAME) {
						return _currentFieldName.toLowerCase();
					}
					return super.getText();
				}
			};
		}
	});
}
 
Example #4
Source File: ProtobufKafkaSourceProviderTest.java    From stateful-functions with Apache License 2.0 5 votes vote down vote up
private static JsonNode fromPath(String path) {
  URL moduleUrl = ProtobufKafkaSourceProvider.class.getClassLoader().getResource(path);
  ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
  try {
    return mapper.readTree(moduleUrl);
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
Example #5
Source File: YamlUtils.java    From flink-statefun with Apache License 2.0 5 votes vote down vote up
public static JsonNode loadAsJsonFromClassResource(ClassLoader classLoader, String pathToYaml) {
  URL moduleUrl = classLoader.getResource(pathToYaml);
  ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
  try {
    return mapper.readTree(moduleUrl);
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
Example #6
Source File: JsonServiceLoader.java    From stateful-functions with Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
static ObjectMapper mapper() {
  return new ObjectMapper(new YAMLFactory());
}
 
Example #7
Source File: JsonServiceLoader.java    From flink-statefun with Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
static ObjectMapper mapper() {
  return new ObjectMapper(new YAMLFactory());
}