All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.search.SimpleFacetExpression Maven / Gradle / Ivy

There is a newer version: 1.0.0-M26
Show newest version
package io.sphere.sdk.search;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

abstract class SimpleFacetExpression extends SimpleBaseExpression implements FacetExpression {
    private final String sphereFacetExpression;

    SimpleFacetExpression(final String sphereFacetExpression) {
        this.sphereFacetExpression = sphereFacetExpression;
    }

    @Override
    public String expression() {
        return sphereFacetExpression;
    }

    @Override
    public String resultPath() {
        final Pattern pattern = Pattern.compile(".* as ([\\w]*)");
        final Matcher matcher = pattern.matcher(expression());
        return matcher.find() ? matcher.group(1) : attributePath();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy