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 theClassresources within theArchiveis up to the implementations/specifications.- Version:
- $Revision: $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TaddClass(java.lang.Class<?> clazz)TaddClass(java.lang.String fullyQualifiedClassName)Adds theClass, and all member (inner)Classes, with the specified fully-qualified name, loaded by the Thread ContextClassLoader, to theArchive.TaddClass(java.lang.String fullyQualifiedClassName, java.lang.ClassLoader cl)Adds theClass, and all member (inner) @link{Class}es, with the specified fully-qualified name, loaded by the specifiedClassLoader, to theArchive.TaddClasses(java.lang.Class<?>... classes)TaddDefaultPackage()Adds all classes in the defaultPackageto theArchive.TaddPackage(java.lang.Package pack)Adds all classes in the specifiedPackageto theArchive.TaddPackage(java.lang.String pack)Adds all classes in the specifiedPackageto theArchive.TaddPackages(boolean recursive, java.lang.Package... packages)Adds all classes in the specifiedPackages to theArchive.TaddPackages(boolean recursive, java.lang.String... packages)Adds all classes in the specifiedPackages to theArchive.TaddPackages(boolean recursive, Filter<ArchivePath> filter, java.lang.Package... packages)Adds all classes accepted by the filter in the specifiedPackages to theArchive.TaddPackages(boolean recursive, Filter<ArchivePath> filter, java.lang.String... packages)Adds all classes accepted by the filter in the specifiedPackages to theArchive.TdeleteClass(java.lang.Class<?> clazz)TdeleteClass(java.lang.String fullyQualifiedClassName)Deletes theClass, and all member (inner)Classes, with the specified fully-qualified name, loaded by the Thread ContextClassLoader, from theArchive.TdeleteClasses(java.lang.Class<?>... classes)TdeleteDefaultPackage()Deletes all classes in the defaultPackagefrom theArchive.TdeletePackage(java.lang.Package pack)Deletes all classes in the specifiedPackagefrom theArchive.TdeletePackage(java.lang.String pack)Deletes all classes in the specifiedPackagefrom theArchive.TdeletePackages(boolean recursive, java.lang.Package... packages)Deletes all classes in the specifiedPackages from theArchive.TdeletePackages(boolean recursive, java.lang.String... packages)Delete all classes in the specifiedPackages from theArchive.TdeletePackages(boolean recursive, Filter<ArchivePath> filter, java.lang.Package... packages)Deletes all classes accepted by the filter in the specifiedPackages from theArchive.TdeletePackages(boolean recursive, Filter<ArchivePath> filter, java.lang.String... packages)Delete all classes accepted by the filter in the specifiedPackages from theArchive.-
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(java.lang.Class<?> clazz) throws java.lang.IllegalArgumentException
- Parameters:
class- The class to add to the Archive- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no class were specified
-
addClass
T addClass(java.lang.String fullyQualifiedClassName) throws java.lang.IllegalArgumentException
Adds theClass, and all member (inner)Classes, with the specified fully-qualified name, loaded by the Thread ContextClassLoader, to theArchive.- Parameters:
fullyQualifiedClassName- The name of theClassto add- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no class name was specifiedjava.lang.IllegalArgumentException- If theClasscould not be loaded
-
addClass
T addClass(java.lang.String fullyQualifiedClassName, java.lang.ClassLoader cl) throws java.lang.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 theClassto addcl- TheClassLoaderused to load the Class- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no class name was specifiedjava.lang.IllegalArgumentException- If noClassLoaderwas specifiedjava.lang.IllegalArgumentException- If theClasscould not be loaded by the targetClassLoader
-
addClasses
T addClasses(java.lang.Class<?>... classes) throws java.lang.IllegalArgumentException
- Parameters:
classes- The classes to add to the Archive- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no classes were specified
-
addPackage
T addPackage(java.lang.Package pack) throws java.lang.IllegalArgumentException
- Parameters:
pack- ThePackageto add- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- If no package were specified- See Also:
addPackages(boolean, Package...)
-
addDefaultPackage
T addDefaultPackage()
- Returns:
- This virtual archive
-
addPackages
T addPackages(boolean recursive, java.lang.Package... packages) throws java.lang.IllegalArgumentException
Adds all classes in the specifiedPackages to theArchive.- Parameters:
recursive- Should the sub packages be addedpackages- All the packages to add- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- If no packages were specified- See Also:
addPackages(boolean, Filter, Package...)
-
addPackages
T addPackages(boolean recursive, Filter<ArchivePath> filter, java.lang.Package... packages) throws java.lang.IllegalArgumentException
Adds all classes accepted by the filter in the specifiedPackages to theArchive.
TheArchivePathreturned to the filter is theArchivePathof 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:
java.lang.IllegalArgumentException- If no packages were specified
-
addPackage
T addPackage(java.lang.String pack) throws java.lang.IllegalArgumentException
- Parameters:
pack- Package to add represented by a String ("my/package")- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- If no package were specified- See Also:
addPackages(boolean, Package...)
-
addPackages
T addPackages(boolean recursive, java.lang.String... packages) throws java.lang.IllegalArgumentException
Adds all classes in the specifiedPackages to theArchive.- Parameters:
recursive- Should the sub packages be addedpackages- All the packages to add represented by a String ("my/package")- Returns:
- This virtual archive
- Throws:
java.lang.IllegalArgumentException- If no packages were specified- See Also:
addPackages(boolean, Filter, Package...)
-
addPackages
T addPackages(boolean recursive, Filter<ArchivePath> filter, java.lang.String... packages) throws java.lang.IllegalArgumentException
Adds all classes accepted by the filter in the specifiedPackages to theArchive.
TheArchivePathreturned to the filter is theArchivePathof 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:
java.lang.IllegalArgumentException- If no packages were specified
-
deleteClass
T deleteClass(java.lang.Class<?> clazz) throws java.lang.IllegalArgumentException
- Parameters:
class- The class to be deleted from the Archive- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no class was specified
-
deleteClass
T deleteClass(java.lang.String fullyQualifiedClassName) throws java.lang.IllegalArgumentException
Deletes theClass, and all member (inner)Classes, with the specified fully-qualified name, loaded by the Thread ContextClassLoader, from theArchive.- Parameters:
fullyQualifiedClassName- The name of theClassto be deleted- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no class name was specifiedjava.lang.IllegalArgumentException- If theClasscould not be loaded
-
deleteClasses
T deleteClasses(java.lang.Class<?>... classes) throws java.lang.IllegalArgumentException
- Parameters:
classes- The classes to be removed from theArchive- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no classes were specified
-
deletePackage
T deletePackage(java.lang.Package pack) throws java.lang.IllegalArgumentException
- Parameters:
pack- ThePackageto be deleted- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no package was specified- See Also:
deletePackages(boolean, Package...)
-
deletePackage
T deletePackage(java.lang.String pack) throws java.lang.IllegalArgumentException
- Parameters:
pack- Package to be delete represented by a String ("my/package")- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no package was specified- See Also:
deletePackages(boolean, Package...)
-
deleteDefaultPackage
T deleteDefaultPackage()
- Returns:
- This archive
-
deletePackages
T deletePackages(boolean recursive, java.lang.Package... packages) throws java.lang.IllegalArgumentException
Deletes all classes in the specifiedPackages from theArchive.- Parameters:
recursive- Should the sub packages be deleted?packages- All the packages to be deleted- Returns:
- This archive
- Throws:
java.lang.IllegalArgumentException- If no packages were specified- See Also:
deletePackages(boolean, Filter, Package...)
-
deletePackages
T deletePackages(boolean recursive, java.lang.String... packages) throws java.lang.IllegalArgumentException
Delete all classes in the specifiedPackages from theArchive.- 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:
java.lang.IllegalArgumentException- If no packages were specified- See Also:
deletePackages(boolean, Filter, Package...)
-
deletePackages
T deletePackages(boolean recursive, Filter<ArchivePath> filter, java.lang.Package... packages) throws java.lang.IllegalArgumentException
Deletes all classes accepted by the filter in the specifiedPackages from theArchive.
TheArchivePathreturned to the filter is theArchivePathof 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:
java.lang.IllegalArgumentException- If no packages were specified or if no filter was specified
-
deletePackages
T deletePackages(boolean recursive, Filter<ArchivePath> filter, java.lang.String... packages) throws java.lang.IllegalArgumentException
Delete all classes accepted by the filter in the specifiedPackages from theArchive.
TheArchivePathreturned to the filter is theArchivePathof 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:
java.lang.IllegalArgumentException- If no packages were specified or if no filter was specified
-
-