Class RuntimeResource

All Implemented Interfaces:

public class RuntimeResource extends Object implements ResourceModelComponent
Runtime resource is a group of resources with the same path regular expression. Runtime resource is constructed from resources creating the resource model.

Runtime resource can have child runtime resources which are groups of child resources of all resources constructing this runtime resource.

The following example shows how Runtime resource structure is built from Resource model:

 public class TemplateResourceFoo {
     public String getFoo() {...}

     public String getX() {...}

     public String postY(String entity) {...}

 public class TemplateResourceBar {
     public String putZ(String entity) {...}
Will be represented by RuntimeResources:
line RuntimeResource regex Grouped Resources (paths) Parent RuntimeResource (line)
1 "/([^/]+?)" Resource("{foo}"), Resource("{bar}") no parent
2 "child" Child Resource("child") 1
3 "/([^/]+?)" Child Resource("{x}"), Child Resource("{y}"), Child Resource("{z}") 1
Miroslav Fuksa
  • Field Details


      public static final Comparator<RuntimeResource> COMPARATOR
      Comparator of RuntimeResources based on rules respecting resource matching algorithm.
  • Method Details

    • getChildRuntimeResources

      public List<RuntimeResource> getChildRuntimeResources()
      Get child runtime resources of this resource.
      List of child runtime resource.
    • getRegex

      public String getRegex()
      Get regular expression of path pattern of this runtime resource.
      Matching regular expression.
    • getResourceMethods

      public List<ResourceMethod> getResourceMethods()
      Get resource methods (excluding resource locators) of all resources of this runtime resource.
      List of resource methods.
    • getResourceLocators

      public List<ResourceMethod> getResourceLocators()
      Get resource locators of all resources of this runtime resource.

      Note that valid RuntimeResource should have only one resource locator. This method is used for validation purposes.

      List of resource locators.
    • getResourceLocator

      public ResourceMethod getResourceLocator()
      Return the resource locator of this resource.
      Resource locator of this runtime resource.
    • getParent

      public RuntimeResource getParent()
      Get parent of this runtime resource.
      Parent runtime resource if this runtime resource is a child resource, null otherwise.
    • getPathPattern

      public PathPattern getPathPattern()
      Get path pattern for matching purposes.
      Path pattern.
    • getFullPathRegex

      public String getFullPathRegex()
      Get full regular expression of this runtime resource prefixed by regular expression of parent if present.
      Full resource regular expression.
    • getParentResources

      public List<Resource> getParentResources()
      Return parent resources of resources from this runtime resource. The returned list is ordered so that the position of the parent resource in the returned list is the same as position of its child resource in list returned by getResources(). Simply said the order of lists returned from getParentResources() and getResources() from parent-child point of view is the same. If the resource has no parent then the element null is in the list.
      Parent resource list with resources if this runtime resource is child resource or null elements if this runtime resource is the parent resource.
    • getResources

      public List<Resource> getResources()
      Get resources creating this runtime resource.
      List of resources with same path regular expression which this resource is based on.
    • accept

      public void accept(ResourceModelVisitor visitor)
      Description copied from interface: ResourceModelComponent
      A component should call the visitor back with an appropriate visitor interface method to give it a chance to process.
      Specified by:
      accept in interface ResourceModelComponent
      visitor - resource model visitor.
    • getComponents

      public List<? extends ResourceModelComponent> getComponents()
      Description copied from interface: ResourceModelComponent
      Should return all existing resource model sub-components.
      Specified by:
      getComponents in interface ResourceModelComponent
      list of all sub-components