Class ClassPathResourceProvider

java.lang.Object
com.helger.io.resourceprovider.ClassPathResourceProvider
All Implemented Interfaces:
IReadableResourceProvider

@Immutable public final class ClassPathResourceProvider extends Object implements IReadableResourceProvider
Simple resource provider that only uses files.
Author:
Philip Helger
  • Constructor Details

    • ClassPathResourceProvider

      public ClassPathResourceProvider()
      Constructor without prefix.
    • ClassPathResourceProvider

      public ClassPathResourceProvider(@Nullable String sPrefix)
      Constructor
      Parameters:
      sPrefix - The common prefix to use. May be null.
  • Method Details

    • getPrefix

      public @Nullable String getPrefix()
      Returns:
      The prefix as passed in the constructor. May be null.
    • supportsReading

      public boolean supportsReading(@Nullable String sName)
      Check if this resource provider can handle the resource with the passed name. If there is no real check on whether your resource provider can handle it, simply return true.
      Specified by:
      supportsReading in interface IReadableResourceProvider
      Parameters:
      sName - The name to check. May be null.
      Returns:
      true if the name is not null and can be handled by this provider, false otherwise.
    • getReadableResource

      public @NonNull IReadableResource getReadableResource(@NonNull String sName)
      Get the resource specified by the given name for reading.
      Specified by:
      getReadableResource in interface IReadableResourceProvider
      Parameters:
      sName - The name of the resource to resolve.
      Returns:
      The readable resource. Never null.
    • 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