Class Resources2

java.lang.Object
com.complexible.common.base.Resources2

public class Resources2 extends Object

Since:
2.0
Version:
2.0
Author:
Michael Grove
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static URL
    getResource(Class<?> theClass, String theResource)
    Get a resource from the file path specified by the resource name and if that file does not exist, check within the class path, first in the location of the specified class, and then if not found, at the root.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Resources2

      public Resources2()
  • Method Details

    • getResource

      public static URL getResource(Class<?> theClass, String theResource)

      Get a resource from the file path specified by the resource name and if that file does not exist, check within the class path, first in the location of the specified class, and then if not found, at the root. If the resource is not found for any reason, null is returned.

      getResource(MyClass.class, "myprops.properties") will first check for the File "myprops.properties" if that does not exist, then MyClass.getResource("myprops.properties") is checked, and finally if it's still not found, MyClass.getResource("/myprops.properties") will be checked.

      Parameters:
      theClass - the class whose classpath the resource might be located in
      theResource - the name of the resource to get the location of
      Returns:
      the URL to the resource or null if not found