Class SwaggerBuilder.PathMetaData

  • Enclosing class:
    SwaggerBuilder

    public class SwaggerBuilder.PathMetaData
    extends Object
    Metadata for constructing URLs and Swagger 'Path' objects.
    • Constructor Detail

      • PathMetaData

        public PathMetaData​(com.yahoo.elide.core.type.Type<?> type)
        Constructs a PathMetaData for a 'root' entity.
        Parameters:
        type - the 'root' entity type of the first segment of the URL.
      • PathMetaData

        public PathMetaData​(Stack<SwaggerBuilder.PathMetaData> lineage,
                            String name,
                            com.yahoo.elide.core.type.Type<?> type)
        Required argument constructor.
        Parameters:
        lineage - The lineage of prior path elements.
        name - The relationship of the path element.
        type - The type associated with the relationship.
    • Method Detail

      • getRootType

        public com.yahoo.elide.core.type.Type<?> getRootType()
        Returns the root type (first collection) of this path.
        Returns:
        The class that represents the root collection of the path.
      • getCollectionUrl

        public String getCollectionUrl()
        Returns a URL that represents the collection.
        Returns:
        Something like '/book/{bookId}/authors' or '/publisher'
      • getRelationshipUrl

        public String getRelationshipUrl()
        Constructs a URL that returns a relationship collection.
        Returns:
        Something like '/book/{bookId}/relationships/authors'
        Throws:
        IllegalStateException - for errors.
      • getRelationshipPath

        public io.swagger.models.Path getRelationshipPath()
        Returns the swagger path for a relationship URL.
        Returns:
        the Swagger 'Path' for a relationship URL (/books/{bookId}/relationships/author).
        Throws:
        IllegalStateException - for errors.
      • getCollectionPath

        public io.swagger.models.Path getCollectionPath()
        Returns the Swagger Path for a collection URL.
        Returns:
        the Swagger 'Path' for a collection URL (/books).
      • getInstancePath

        public io.swagger.models.Path getInstancePath()
        Returns the Swagger Path for an instance URL.
        Returns:
        the Swagger 'Path' for a instance URL (/books/{bookID}).
      • getFullLineage

        public Stack<SwaggerBuilder.PathMetaData> getFullLineage()
        Constructs a new lineage including the current path element.
        Returns:
        ALL of the path segments in the URL including this segment.
      • shorterThan

        public boolean shorterThan​(SwaggerBuilder.PathMetaData compare)
        Returns true if this path is a shorter path to the same entity than the given path.
        Parameters:
        compare - The path to compare against.
        Returns:
        is shorter or same
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object