use of com.fasterxml.jackson.databind.PropertyNamingStrategy.PropertyNamingStrategyBase in project alien4cloud by alien4cloud.
the class AbstractMapper method quickMap.
/**
* Map a field to be parsed as a scalar and mapped to a tosca field that use the same name based on LOWER_CASE_WITH_UNDERSCORES rather than CAMEL_CASE.
*
* @param fieldName The name of the field.
*/
public void quickMap(String fieldName) {
int pathSeparatorLastIndex = fieldName.lastIndexOf(".");
pathSeparatorLastIndex++;
pathSeparatorLastIndex = pathSeparatorLastIndex > 0 ? pathSeparatorLastIndex : 0;
String yamlFieldCamelCase = fieldName.substring(pathSeparatorLastIndex);
String yamlField = ((PropertyNamingStrategyBase) PropertyNamingStrategy.SNAKE_CASE).translate(yamlFieldCamelCase);
log.trace("Mapping yaml field {} to {} using basic ScalarParser", yamlField, fieldName);
instance.getYamlToObjectMapping().put(yamlField, new MappingTarget(fieldName, scalarParser));
}
use of com.fasterxml.jackson.databind.PropertyNamingStrategy.PropertyNamingStrategyBase in project alien4cloud by alien4cloud.
the class AbstractMapper method quickMap.
/**
* Map a field to be parsed with the given parser and mapped to a tosca field that use the same name based on LOWER_CASE_WITH_UNDERSCORES rather than
* CAMEL_CASE.
*
* @param parser The parser to use to parse the field.
* @param fieldName The name of the field to parse.
*/
public void quickMap(INodeParser<?> parser, String fieldName) {
int pathSeparatorLastIndex = fieldName.lastIndexOf(".");
pathSeparatorLastIndex++;
pathSeparatorLastIndex = pathSeparatorLastIndex > 0 ? pathSeparatorLastIndex : 0;
String yamlFieldCamelCase = fieldName.substring(pathSeparatorLastIndex);
String yamlField = ((PropertyNamingStrategyBase) PropertyNamingStrategy.SNAKE_CASE).translate(yamlFieldCamelCase);
log.info("Mapping yaml field {} to {} using basic ScalarParser", yamlField, fieldName);
instance.getYamlToObjectMapping().put(yamlField, new MappingTarget(fieldName, parser));
}
Aggregations