Class RequestPath


  • public class RequestPath
    extends java.lang.Object
    Represents a URI request path that has been resolved to an object path. Offers methods to access objects in the path by index and prototype names, and to render the path as URI again.
    • Constructor Summary

      Constructors 
      Constructor Description
      RequestPath​(Application app)
      Creates a new RequestPath object.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void add​(java.lang.String id, java.lang.Object obj)
      Adds an item to the end of the path.
      int contains​(java.lang.Object obj)
      Deprecated.
      use indexOf(Object) instead.
      java.lang.Object get​(int idx)
      Gets an object in the path by index.
      java.lang.Object getByPrototypeName​(java.lang.String typeName)
      Gets an object in the path by prototype name.
      java.lang.String href​(java.lang.String action)
      Returns the string representation of this path usable for links.
      int indexOf​(java.lang.Object obj)
      Checks if the given object is contained in the request path.
      int size()
      Returns the number of objects in the request path.
      java.lang.String toString()
      Return a string representation of the Request Path
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • RequestPath

        public RequestPath​(Application app)
        Creates a new RequestPath object.
        Parameters:
        app - the application we're running in
    • Method Detail

      • add

        public void add​(java.lang.String id,
                        java.lang.Object obj)
        Adds an item to the end of the path.
        Parameters:
        id - the item id representing the path in the URL
        obj - the object to which the id resolves
      • size

        public int size()
        Returns the number of objects in the request path.
      • get

        public java.lang.Object get​(int idx)
        Gets an object in the path by index.
        Parameters:
        idx - the index of the object in the request path
      • getByPrototypeName

        public java.lang.Object getByPrototypeName​(java.lang.String typeName)
        Gets an object in the path by prototype name.
        Parameters:
        typeName - the prototype name of the object in the request path
      • href

        public java.lang.String href​(java.lang.String action)
                              throws java.io.UnsupportedEncodingException
        Returns the string representation of this path usable for links.
        Throws:
        java.io.UnsupportedEncodingException
      • contains

        @Deprecated
        public int contains​(java.lang.Object obj)
        Deprecated.
        use indexOf(Object) instead.
        Checks if the given object is contained in the request path. Itreturns the zero-based index position, or -1 if it isn't contained.
        Parameters:
        obj - the element to check
        Returns:
        the index of the element, or -1 if it isn't contained
      • indexOf

        public int indexOf​(java.lang.Object obj)
        Checks if the given object is contained in the request path. Itreturns the zero-based index position, or -1 if it isn't contained.
        Parameters:
        obj - the element to check
        Returns:
        the index of the element, or -1 if it isn't contained
      • toString

        public java.lang.String toString()
        Return a string representation of the Request Path
        Overrides:
        toString in class java.lang.Object