Package com.complexible.common.base
Class Resources2
- java.lang.Object
-
- com.complexible.common.base.Resources2
-
public class Resources2 extends java.lang.Object
- Since:
- 2.0
- Version:
- 2.0
- Author:
- Michael Grove
-
-
Constructor Summary
Constructors Constructor Description Resources2()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.net.URL
getResource(java.lang.Class<?> theClass, java.lang.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.
-
-
-
Method Detail
-
getResource
public static java.net.URL getResource(java.lang.Class<?> theClass, java.lang.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:
theResource
- the name of the resource to get the location oftheClass
- the class whose classpath the resource might be located in- Returns:
- the URL to the resource or null if not found
-
-