Package org.jboss.shrinkwrap.api.asset
Class ClassAsset
java.lang.Object
org.jboss.shrinkwrap.api.asset.ClassAsset
- All Implemented Interfaces:
Asset
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate String
getResourceNameOfClass
(Class<?> clazz) Returns the name of the class such that it may be accessed via ClassLoader.getResource()Class
<?> Returns the loaded class.Converts the Class name into a Resource URL and uses the ClassloaderResource for loading the Class.
-
Field Details
-
DELIMITER_RESOURCE_PATH
private static final char DELIMITER_RESOURCE_PATHDelimiter for paths while looking for resources- See Also:
-
DELIMITER_CLASS_NAME_PATH
private static final char DELIMITER_CLASS_NAME_PATHDelimiter for paths in fully-qualified class names- See Also:
-
EXTENSION_CLASS
The filename extension appended to classes- See Also:
-
clazz
-
-
Constructor Details
-
ClassAsset
Load any class as a resource.- Parameters:
clazz
- The class to load- Throws:
IllegalArgumentException
- Class can not be null
-
-
Method Details
-
openStream
Converts the Class name into a Resource URL and uses the ClassloaderResource for loading the Class.- Specified by:
openStream
in interfaceAsset
- Returns:
- A new open
InputStream
for each call
-
getSource
Returns the loaded class. -
getResourceNameOfClass
Returns the name of the class such that it may be accessed via ClassLoader.getResource()- Parameters:
clazz
- The class- Throws:
IllegalArgumentException
- If the class was not specified
-