Search in sources :

Example 1 with FieldSegment

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

the class CollectionPattern method getCollectionPatternsFromMethod.

/**
 * Returns a list of CollectionPattern objects.
 */
public static List<CollectionPattern> getCollectionPatternsFromMethod(Method method) {
    List<CollectionPattern> collectionPatterns = new LinkedList<CollectionPattern>();
    HttpAttribute httpAttr = method.getAttribute(HttpAttribute.KEY);
    if (httpAttr != null) {
        for (PathSegment pathSegment : httpAttr.getPath()) {
            if (CollectionPattern.isValidCollectionPattern(pathSegment)) {
                collectionPatterns.add(CollectionPattern.create((FieldSegment) pathSegment));
            }
        }
    }
    return collectionPatterns;
}
Also used : HttpAttribute(com.google.api.tools.framework.aspects.http.model.HttpAttribute) FieldSegment(com.google.api.tools.framework.aspects.http.model.HttpAttribute.FieldSegment) PathSegment(com.google.api.tools.framework.aspects.http.model.HttpAttribute.PathSegment) LinkedList(java.util.LinkedList)

Aggregations

HttpAttribute (com.google.api.tools.framework.aspects.http.model.HttpAttribute)1 FieldSegment (com.google.api.tools.framework.aspects.http.model.HttpAttribute.FieldSegment)1 PathSegment (com.google.api.tools.framework.aspects.http.model.HttpAttribute.PathSegment)1 LinkedList (java.util.LinkedList)1