Class StandardResourceReferences

java.lang.Object
org.apache.nifi.components.resource.StandardResourceReferences
All Implemented Interfaces:
ResourceReferences

public class StandardResourceReferences extends Object implements ResourceReferences
  • Field Details

  • Constructor Details

    • StandardResourceReferences

      public StandardResourceReferences(List<ResourceReference> resourceReferences)
  • Method Details

    • asList

      public List<ResourceReference> asList()
      Specified by:
      asList in interface ResourceReferences
      Returns:
      a List representation of all Resource References
    • asLocations

      public List<String> asLocations()
      Specified by:
      asLocations in interface ResourceReferences
      Returns:
      a list of all Resource References' locations
    • asURLs

      public List<URL> asURLs()
      Specified by:
      asURLs in interface ResourceReferences
      Returns:
      a list of all Resource References' URLs
    • getCount

      public int getCount()
      Specified by:
      getCount in interface ResourceReferences
      Returns:
      the number of Resource References held
    • flatten

      public ResourceReferences flatten()
      Description copied from interface: ResourceReferences
      Iterates through the Resource References and for any reference that may represent more than one resource, flattens the resource into a List of single-entity references. For example, consider that this ResourceReferences holds a single ResourceReference, of type DIRECTORY and the referenced directory contains 10 files. Calling ResourceReferences.asList() would return a single ResourceReference. But calling flatten() would return a new ResourceReferences type whose ResourceReferences.asList() method would return 10 ResourceReference objects, each with a ResourceType of FILE. The flatten operation is not recursive, meaning that if a DIRECTORY is flattened, any sub-directories will be dropped. If the contents of the subdirectories are to be retained, use ResourceReferences.flattenRecursively() instead.
      Specified by:
      flatten in interface ResourceReferences
      Returns:
      a flattened ResourceReferences
    • addChildren

      private void addChildren(File file, List<ResourceReference> flattened)
    • flattenRecursively

      public ResourceReferences flattenRecursively()
      Description copied from interface: ResourceReferences
      Recursively iterates through the Resource References and for any reference that may represent more than one resource, flattens the resource into a List of single-entity references. For example, consider that this ResourceReferences holds a single ResourceReference, of type DIRECTORY and the referenced directory contains 10 files. Calling ResourceReferences.asList() would return a single ResourceReference. But calling flatten() would return a new ResourceReferences type whose ResourceReferences.asList() method would return 10 ResourceReference objects, each with a ResourceType of FILE. The flatten operation is recursive, meaning that if a DIRECTORY is encountered, its reference will be replaced with a new reference for each file, even if that file exists 100 levels deep in the directory structure.
      Specified by:
      flattenRecursively in interface ResourceReferences
      Returns:
      a flattened ResourceReferences
    • recurse

      private void recurse(File file, List<ResourceReference> flattened)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object