Search in sources :

Example 1 with YamlPathSegmentType

use of org.springframework.ide.vscode.commons.yaml.path.YamlPathSegment.YamlPathSegmentType in project sts4 by spring-projects.

the class YamlPath method getBeanPropertyName.

/**
 * Attempt to interpret last segment of path as a bean property name.
 * @return The name of the property or null if not applicable.
 */
public String getBeanPropertyName() {
    if (!isEmpty()) {
        YamlPathSegment lastSegment = getLastSegment();
        YamlPathSegmentType kind = lastSegment.getType();
        if (kind == YamlPathSegmentType.KEY_AT_KEY || kind == YamlPathSegmentType.VAL_AT_KEY) {
            return lastSegment.toPropString();
        }
    }
    return null;
}
Also used : YamlPathSegmentType(org.springframework.ide.vscode.commons.yaml.path.YamlPathSegment.YamlPathSegmentType)

Aggregations

YamlPathSegmentType (org.springframework.ide.vscode.commons.yaml.path.YamlPathSegment.YamlPathSegmentType)1