Search in sources :

Example 1 with WildcardSegment

use of com.google.api.tools.framework.aspects.http.model.HttpAttribute.WildcardSegment in project toolkit by googleapis.

the class CollectionPattern method isValidCollectionPattern.

private static boolean isValidCollectionPattern(FieldSegment fieldSegment) {
    ImmutableList<PathSegment> subPath = fieldSegment.getSubPath();
    if (subPath == null) {
        return false;
    }
    if (subPath.size() <= 1) {
        return false;
    }
    boolean containsLiteralWildcardPair = false;
    PathSegment lastSegment = null;
    for (PathSegment segment : subPath) {
        if (segment instanceof WildcardSegment && lastSegment != null && lastSegment instanceof LiteralSegment) {
            containsLiteralWildcardPair = true;
            break;
        }
        lastSegment = segment;
    }
    if (!containsLiteralWildcardPair) {
        return false;
    }
    return true;
}
Also used : LiteralSegment(com.google.api.tools.framework.aspects.http.model.HttpAttribute.LiteralSegment) PathSegment(com.google.api.tools.framework.aspects.http.model.HttpAttribute.PathSegment) WildcardSegment(com.google.api.tools.framework.aspects.http.model.HttpAttribute.WildcardSegment)

Aggregations

LiteralSegment (com.google.api.tools.framework.aspects.http.model.HttpAttribute.LiteralSegment)1 PathSegment (com.google.api.tools.framework.aspects.http.model.HttpAttribute.PathSegment)1 WildcardSegment (com.google.api.tools.framework.aspects.http.model.HttpAttribute.WildcardSegment)1