Google.Api.Gax.PathTemplate.PathTemplate C# (CSharp) Method

PathTemplate() public method

Constructs a template from its textual representation, such as shelves/*/books/**.
public PathTemplate ( string template ) : System
template string The textual representation of the template. Must not be null.
return System
        public PathTemplate(string template)
        {
            GaxPreconditions.CheckNotNull(template, nameof(template));
            _segments = template.Split(s_slashSplit).Select(Segment.Parse).ToList();
            _parameterSegments = _segments.Where(s => s.Kind != SegmentKind.Literal).ToList();
            int pathWildcardCount = _segments.Count(s => s.Kind == SegmentKind.PathWildcard);
            if (pathWildcardCount > 1)
            {
                throw new ArgumentException("Template contains multiple path wildcards", nameof(template));
            }
            _hasPathWildcard = pathWildcardCount != 0;
            _originalTemplate = template;
            ParameterNames = _parameterSegments.Select(x => x.Value).ToList().AsReadOnly();
        }