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

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

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

import io.sphere.sdk.models.Base;

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

abstract class SimpleBaseExpression extends Base {

    protected SimpleBaseExpression() {
    }

    abstract protected String expression();

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy