Class ClassPathUtils
- java.lang.Object
-
- org.apache.commons.lang3.ClassPathUtils
-
public class ClassPathUtils extends java.lang.ObjectOperations regarding the classpath.The methods of this class do not allow
nullinputs.- Since:
- 3.3
-
-
Constructor Summary
Constructors Constructor Description ClassPathUtils()ClassPathUtilsinstances should NOT be constructed in standard programming.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringtoFullyQualifiedName(java.lang.Class<?> context, java.lang.String resourceName)Returns the fully qualified name for the resource with nameresourceNamerelative to the given context.static java.lang.StringtoFullyQualifiedName(java.lang.Package context, java.lang.String resourceName)Returns the fully qualified name for the resource with nameresourceNamerelative to the given context.static java.lang.StringtoFullyQualifiedPath(java.lang.Class<?> context, java.lang.String resourceName)Returns the fully qualified path for the resource with nameresourceNamerelative to the given context.static java.lang.StringtoFullyQualifiedPath(java.lang.Package context, java.lang.String resourceName)Returns the fully qualified path for the resource with nameresourceNamerelative to the given context.
-
-
-
Constructor Detail
-
ClassPathUtils
public ClassPathUtils()
ClassPathUtilsinstances should NOT be constructed in standard programming. Instead, the class should be used asClassPathUtils.toFullyQualifiedName(MyClass.class, "MyClass.properties");.This constructor is public to permit tools that require a JavaBean instance to operate.
-
-
Method Detail
-
toFullyQualifiedName
public static java.lang.String toFullyQualifiedName(java.lang.Class<?> context, java.lang.String resourceName)Returns the fully qualified name for the resource with nameresourceNamerelative to the given context.Note that this method does not check whether the resource actually exists. It only constructs the name. Null inputs are not allowed.
ClassPathUtils.toFullyQualifiedName(StringUtils.class, "StringUtils.properties") = "org.apache.commons.lang3.StringUtils.properties"
- Parameters:
context- The context for constructing the name.resourceName- the resource name to construct the fully qualified name for.- Returns:
- the fully qualified name of the resource with name
resourceName. - Throws:
java.lang.NullPointerException- if eithercontextorresourceNameis null.
-
toFullyQualifiedName
public static java.lang.String toFullyQualifiedName(java.lang.Package context, java.lang.String resourceName)Returns the fully qualified name for the resource with nameresourceNamerelative to the given context.Note that this method does not check whether the resource actually exists. It only constructs the name. Null inputs are not allowed.
ClassPathUtils.toFullyQualifiedName(StringUtils.class.getPackage(), "StringUtils.properties") = "org.apache.commons.lang3.StringUtils.properties"
- Parameters:
context- The context for constructing the name.resourceName- the resource name to construct the fully qualified name for.- Returns:
- the fully qualified name of the resource with name
resourceName. - Throws:
java.lang.NullPointerException- if eithercontextorresourceNameis null.
-
toFullyQualifiedPath
public static java.lang.String toFullyQualifiedPath(java.lang.Class<?> context, java.lang.String resourceName)Returns the fully qualified path for the resource with nameresourceNamerelative to the given context.Note that this method does not check whether the resource actually exists. It only constructs the path. Null inputs are not allowed.
ClassPathUtils.toFullyQualifiedPath(StringUtils.class, "StringUtils.properties") = "org/apache/commons/lang3/StringUtils.properties"
- Parameters:
context- The context for constructing the path.resourceName- the resource name to construct the fully qualified path for.- Returns:
- the fully qualified path of the resource with name
resourceName. - Throws:
java.lang.NullPointerException- if eithercontextorresourceNameis null.
-
toFullyQualifiedPath
public static java.lang.String toFullyQualifiedPath(java.lang.Package context, java.lang.String resourceName)Returns the fully qualified path for the resource with nameresourceNamerelative to the given context.Note that this method does not check whether the resource actually exists. It only constructs the path. Null inputs are not allowed.
ClassPathUtils.toFullyQualifiedPath(StringUtils.class.getPackage(), "StringUtils.properties") = "org/apache/commons/lang3/StringUtils.properties"
- Parameters:
context- The context for constructing the path.resourceName- the resource name to construct the fully qualified path for.- Returns:
- the fully qualified path of the resource with name
resourceName. - Throws:
java.lang.NullPointerException- if eithercontextorresourceNameis null.
-
-