Interface ClassContainer<T extends Archive<T>>
-
- All Superinterfaces:
ResourceContainer<T>
- All Known Subinterfaces:
JavaArchive
,ServiceProviderContainer<T>
,WebArchive
- All Known Implementing Classes:
ContainerBase
,EnterpriseArchiveImpl
,EnterpriseContainerBase
,GenericArchiveImpl
,JavaArchiveImpl
,ResourceAdapterArchiveImpl
,ResourceAdapterContainerBase
,WebArchiveImpl
,WebContainerBase
public interface ClassContainer<T extends Archive<T>> extends ResourceContainer<T>
Defines the contract for a component capable of storing Java Classes.
The actual path to theClass
resources within theArchive
is up to the implementations/specifications.- Version:
- $Revision: $
- Author:
- Aslak Knutsen
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
addClass(Class<?> clazz)
T
addClass(String fullyQualifiedClassName)
Adds theClass
, and all member (inner)Class
es, with the specified fully-qualified name, loaded by the Thread ContextClassLoader
, to theArchive
.T
addClass(String fullyQualifiedClassName, ClassLoader cl)
Adds theClass
, and all member (inner) @link{Class}es, with the specified fully-qualified name, loaded by the specifiedClassLoader
, to theArchive
.T
addClasses(Class<?>... classes)
T
addDefaultPackage()
T
addPackage(Package pack)
T
addPackage(String pack)
T
addPackages(boolean recursive, Package... packages)
T
addPackages(boolean recursive, String... packages)
T
addPackages(boolean recursive, Filter<ArchivePath> filter, Package... packages)
T
addPackages(boolean recursive, Filter<ArchivePath> filter, String... packages)
T
deleteClass(Class<?> clazz)
T
deleteClass(String fullyQualifiedClassName)
Deletes theClass
, and all member (inner)Class
es, with the specified fully-qualified name, loaded by the Thread ContextClassLoader
, from theArchive
.T
deleteClasses(Class<?>... classes)
T
deleteDefaultPackage()
T
deletePackage(Package pack)
T
deletePackage(String pack)
T
deletePackages(boolean recursive, Package... packages)
T
deletePackages(boolean recursive, String... packages)
T
deletePackages(boolean recursive, Filter<ArchivePath> filter, Package... packages)
T
deletePackages(boolean recursive, Filter<ArchivePath> filter, String... packages)
-
Methods inherited from interface org.jboss.shrinkwrap.api.container.ResourceContainer
addAsResource, addAsResource, addAsResource, addAsResource, addAsResource, addAsResource, addAsResource, addAsResource, addAsResource, addAsResource, addAsResource, addAsResource, addAsResource, addAsResource, addAsResources
-
-
-
-
Method Detail
-
addClass
T addClass(Class<?> clazz) throws IllegalArgumentException
- Parameters:
class
- The class to add to the Archive- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no class were specified
-
addClass
T addClass(String fullyQualifiedClassName) throws IllegalArgumentException
Adds theClass
, and all member (inner)Class
es, with the specified fully-qualified name, loaded by the Thread ContextClassLoader
, to theArchive
.- Parameters:
fullyQualifiedClassName
- The name of theClass
to add- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no class name was specifiedIllegalArgumentException
- If theClass
could not be loaded
-
addClass
T addClass(String fullyQualifiedClassName, ClassLoader cl) throws IllegalArgumentException
Adds theClass
, and all member (inner) @link{Class}es, with the specified fully-qualified name, loaded by the specifiedClassLoader
, to theArchive
.- Parameters:
fullyQualifiedClassName
- The name of theClass
to addcl
- TheClassLoader
used to load the Class- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no class name was specifiedIllegalArgumentException
- If noClassLoader
was specifiedIllegalArgumentException
- If theClass
could not be loaded by the targetClassLoader
-
addClasses
T addClasses(Class<?>... classes) throws IllegalArgumentException
- Parameters:
classes
- The classes to add to the Archive- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no classes were specified
-
addPackage
T addPackage(Package pack) throws IllegalArgumentException
- Parameters:
pack
- ThePackage
to add- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- If no package were specified- See Also:
addPackages(boolean, Package...)
-
addDefaultPackage
T addDefaultPackage()
- Returns:
- This virtual archive
-
addPackages
T addPackages(boolean recursive, Package... packages) throws IllegalArgumentException
- Parameters:
recursive
- Should the sub packages be addedpackages
- All the packages to add- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- If no packages were specified- See Also:
addPackages(boolean, Filter, Package...)
-
addPackages
T addPackages(boolean recursive, Filter<ArchivePath> filter, Package... packages) throws IllegalArgumentException
Adds all classes accepted by the filter in the specifiedPackage
s to theArchive
.
TheArchivePath
returned to the filter is theArchivePath
of the class, not the final location.
package.MyClass = /package/MyClass.class
not: package.MyClass = /WEB-INF/classes/package/MyClass.class- Parameters:
recursive
- Should the sub packages be addedfilter
- filter out specific classespackages
- All the packages to add- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- If no packages were specified
-
addPackage
T addPackage(String pack) throws IllegalArgumentException
- Parameters:
pack
- Package to add represented by a String ("my/package")- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- If no package were specified- See Also:
addPackages(boolean, Package...)
-
addPackages
T addPackages(boolean recursive, String... packages) throws IllegalArgumentException
- Parameters:
recursive
- Should the sub packages be addedpackages
- All the packages to add represented by a String ("my/package")- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- If no packages were specified- See Also:
addPackages(boolean, Filter, Package...)
-
addPackages
T addPackages(boolean recursive, Filter<ArchivePath> filter, String... packages) throws IllegalArgumentException
Adds all classes accepted by the filter in the specifiedPackage
s to theArchive
.
TheArchivePath
returned to the filter is theArchivePath
of the class, not the final location.
package.MyClass = /package/MyClass.class
not: package.MyClass = /WEB-INF/classes/package/MyClass.class- Parameters:
recursive
- Should the sub packages be addedfilter
- filter out specific classespackages
- All the packages to add represented by a String ("my/package")- Returns:
- This virtual archive
- Throws:
IllegalArgumentException
- If no packages were specified
-
deleteClass
T deleteClass(Class<?> clazz) throws IllegalArgumentException
- Parameters:
class
- The class to be deleted from the Archive- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no class was specified
-
deleteClass
T deleteClass(String fullyQualifiedClassName) throws IllegalArgumentException
Deletes theClass
, and all member (inner)Class
es, with the specified fully-qualified name, loaded by the Thread ContextClassLoader
, from theArchive
.- Parameters:
fullyQualifiedClassName
- The name of theClass
to be deleted- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no class name was specifiedIllegalArgumentException
- If theClass
could not be loaded
-
deleteClasses
T deleteClasses(Class<?>... classes) throws IllegalArgumentException
- Parameters:
classes
- The classes to be removed from theArchive
- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no classes were specified
-
deletePackage
T deletePackage(Package pack) throws IllegalArgumentException
- Parameters:
pack
- ThePackage
to be deleted- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no package was specified- See Also:
deletePackages(boolean, Package...)
-
deletePackage
T deletePackage(String pack) throws IllegalArgumentException
- Parameters:
pack
- Package to be delete represented by a String ("my/package")- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no package was specified- See Also:
deletePackages(boolean, Package...)
-
deleteDefaultPackage
T deleteDefaultPackage()
- Returns:
- This archive
-
deletePackages
T deletePackages(boolean recursive, Package... packages) throws IllegalArgumentException
- Parameters:
recursive
- Should the sub packages be deleted?packages
- All the packages to be deleted- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no packages were specified- See Also:
deletePackages(boolean, Filter, Package...)
-
deletePackages
T deletePackages(boolean recursive, String... packages) throws IllegalArgumentException
- Parameters:
recursive
- Should the sub packages be deleted?packages
- All the packages to be deleted represented by a String ("my/package")- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no packages were specified- See Also:
deletePackages(boolean, Filter, Package...)
-
deletePackages
T deletePackages(boolean recursive, Filter<ArchivePath> filter, Package... packages) throws IllegalArgumentException
Deletes all classes accepted by the filter in the specifiedPackage
s from theArchive
.
TheArchivePath
returned to the filter is theArchivePath
of the class, not the final location.
package.MyClass = /package/MyClass.class
not: package.MyClass = /WEB-INF/classes/package/MyClass.class- Parameters:
recursive
- Should the sub packages be deleted?filter
- filter out specific classespackages
- All the packages to be deleted- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no packages were specified or if no filter was specified
-
deletePackages
T deletePackages(boolean recursive, Filter<ArchivePath> filter, String... packages) throws IllegalArgumentException
Delete all classes accepted by the filter in the specifiedPackage
s from theArchive
.
TheArchivePath
returned to the filter is theArchivePath
of the class, not the final location.
package.MyClass = /package/MyClass.class
not: package.MyClass = /WEB-INF/classes/package/MyClass.class- Parameters:
recursive
- Should the sub packages be deleted?filter
- filter out specific classespackages
- All the packages to be deleted represented by a String ("my/package")- Returns:
- This archive
- Throws:
IllegalArgumentException
- If no packages were specified or if no filter was specified
-
-