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;
}
Aggregations