Package com.yahoo.elide.swagger
Class SwaggerBuilder.PathMetaData
- java.lang.Object
-
- com.yahoo.elide.swagger.SwaggerBuilder.PathMetaData
-
- Enclosing class:
- SwaggerBuilder
public class SwaggerBuilder.PathMetaData extends Object
Metadata for constructing URLs and Swagger 'Path' objects.
-
-
Constructor Summary
Constructors Constructor Description PathMetaData(com.yahoo.elide.core.type.Type<?> type)Constructs a PathMetaData for a 'root' entity.PathMetaData(Stack<SwaggerBuilder.PathMetaData> lineage, String name, com.yahoo.elide.core.type.Type<?> type)Required argument constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)io.swagger.models.PathgetCollectionPath()Returns the Swagger Path for a collection URL.StringgetCollectionUrl()Returns a URL that represents the collection.Stack<SwaggerBuilder.PathMetaData>getFullLineage()Constructs a new lineage including the current path element.io.swagger.models.PathgetInstancePath()Returns the Swagger Path for an instance URL.io.swagger.models.PathgetRelationshipPath()Returns the swagger path for a relationship URL.StringgetRelationshipUrl()Constructs a URL that returns a relationship collection.com.yahoo.elide.core.type.Type<?>getRootType()Returns the root type (first collection) of this path.inthashCode()booleanshorterThan(SwaggerBuilder.PathMetaData compare)Returns true if this path is a shorter path to the same entity than the given path.StringtoString()
-
-
-
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
-
-