Package org.jboss.shrinkwrap.api.asset
Class ClassAsset
- java.lang.Object
-
- org.jboss.shrinkwrap.api.asset.ClassAsset
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class<?>clazzprivate static charDELIMITER_CLASS_NAME_PATHDelimiter for paths in fully-qualified class namesprivate static charDELIMITER_RESOURCE_PATHDelimiter for paths while looking for resourcesprivate static java.lang.StringEXTENSION_CLASSThe filename extension appended to classes
-
Constructor Summary
Constructors Constructor Description ClassAsset(java.lang.Class<?> clazz)Load any class as a resource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.StringgetResourceNameOfClass(java.lang.Class<?> clazz)Returns the name of the class such that it may be accessed via ClassLoader.getResource()java.lang.Class<?>getSource()Returns the loaded class.java.io.InputStreamopenStream()Converts the Class name into a Resource URL and uses the ClassloaderResource for loading the Class.
-
-
-
Field Detail
-
DELIMITER_RESOURCE_PATH
private static final char DELIMITER_RESOURCE_PATH
Delimiter for paths while looking for resources- See Also:
- Constant Field Values
-
DELIMITER_CLASS_NAME_PATH
private static final char DELIMITER_CLASS_NAME_PATH
Delimiter for paths in fully-qualified class names- See Also:
- Constant Field Values
-
EXTENSION_CLASS
private static final java.lang.String EXTENSION_CLASS
The filename extension appended to classes- See Also:
- Constant Field Values
-
clazz
private java.lang.Class<?> clazz
-
-
Method Detail
-
openStream
public java.io.InputStream openStream()
Converts the Class name into a Resource URL and uses the ClassloaderResource for loading the Class.- Specified by:
openStreamin interfaceAsset- Returns:
- A new open
InputStreamfor each call
-
getSource
public java.lang.Class<?> getSource()
Returns the loaded class.
-
getResourceNameOfClass
private java.lang.String getResourceNameOfClass(java.lang.Class<?> clazz) throws java.lang.IllegalArgumentExceptionReturns the name of the class such that it may be accessed via ClassLoader.getResource()- Parameters:
clazz- The class- Throws:
java.lang.IllegalArgumentException- If the class was not specified
-
-