Java Code Examples for org.elasticsearch.common.Strings#toCamelCase()

The following examples show how to use org.elasticsearch.common.Strings#toCamelCase() . 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: XContentBuilder.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
public XContentBuilder field(String name, FieldCaseConversion conversion) throws IOException {
    if (name == null) {
        throw new IllegalArgumentException("field name cannot be null");
    }
    if (conversion == FieldCaseConversion.UNDERSCORE) {
        if (cachedStringBuilder == null) {
            cachedStringBuilder = new StringBuilder();
        }
        name = Strings.toUnderscoreCase(name, cachedStringBuilder);
    } else if (conversion == FieldCaseConversion.CAMELCASE) {
        if (cachedStringBuilder == null) {
            cachedStringBuilder = new StringBuilder();
        }
        name = Strings.toCamelCase(name, cachedStringBuilder);
    }
    generator.writeFieldName(name);
    return this;
}
 
Example 2
Source File: XmlXContentBuilder.java    From elasticsearch-xml with Apache License 2.0 5 votes vote down vote up
public XmlXContentBuilder field(String name) throws IOException {
    if (fieldCaseConversion == FieldCaseConversion.UNDERSCORE) {
        if (cachedStringBuilder == null) {
            cachedStringBuilder = new StringBuilder();
        }
        name = Strings.toUnderscoreCase(name, cachedStringBuilder);
    } else if (fieldCaseConversion == FieldCaseConversion.CAMELCASE) {
        if (cachedStringBuilder == null) {
            cachedStringBuilder = new StringBuilder();
        }
        name = Strings.toCamelCase(name, cachedStringBuilder);
    }
    generator.writeFieldName(name);
    return this;
}
 
Example 3
Source File: XmlXContentBuilder.java    From elasticsearch-xml with Apache License 2.0 5 votes vote down vote up
public XmlXContentBuilder field(String name, FieldCaseConversion conversion) throws IOException {
    if (conversion == FieldCaseConversion.UNDERSCORE) {
        if (cachedStringBuilder == null) {
            cachedStringBuilder = new StringBuilder();
        }
        name = Strings.toUnderscoreCase(name, cachedStringBuilder);
    } else if (conversion == FieldCaseConversion.CAMELCASE) {
        if (cachedStringBuilder == null) {
            cachedStringBuilder = new StringBuilder();
        }
        name = Strings.toCamelCase(name, cachedStringBuilder);
    }
    generator.writeFieldName(name);
    return this;
}
 
Example 4
Source File: XContentBuilderString.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public XContentBuilderString(String value) {
    underscore = new XContentString(Strings.toUnderscoreCase(value));
    camelCase = new XContentString(Strings.toCamelCase(value));
}