java.lang.Object
io.github.grumpystuff.grumpyrest.request.path.PathSegment
Direct Known Subclasses:
LiteralPathSegment, VariablePathSegment

public abstract class PathSegment extends Object
A single segment from a Path.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract boolean
    matches(String segment)
    Checks whether this segment matches a segment of a path from an incoming request.
    parse(String segmentSpec)
    Parses an instance from a single segment of a string-based path specification.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PathSegment

      protected PathSegment()
      Constructor.
  • Method Details

    • parse

      public static PathSegment parse(String segmentSpec)
      Parses an instance from a single segment of a string-based path specification. The segment is turned into a path parameter (VariablePathSegment) if the segment specification starts with a : character.
      Parameters:
      segmentSpec - the segment specification
      Returns:
      the parsed segment object
    • matches

      public abstract boolean matches(String segment)
      Checks whether this segment matches a segment of a path from an incoming request.
      Parameters:
      segment - the request path segment
      Returns:
      true if the segment matches, false if not