Package fr.ifremer.isisfish.aspect
Class AspectJUrlClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.aspectj.weaver.bcel.ExtensibleURLClassLoader
fr.ifremer.isisfish.aspect.AspectJUrlClassLoader
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.aspectj.weaver.tools.GeneratedClassHandler
,org.aspectj.weaver.tools.WeavingClassLoader
public class AspectJUrlClassLoader
extends org.aspectj.weaver.bcel.ExtensibleURLClassLoader
implements org.aspectj.weaver.tools.WeavingClassLoader
Cette classe est un copié/coller de
WeavingURLClassLoader
qui permet de définit
notre propre instance de adaptor
pour, dans le cas d'IsisFish, permettre d'ajouter des aspects à l'execution.
Elle définie deux nouvelles méthodes:
deploy(Class)
: qui permet de deployer un nouvel aspectprepare()
: à appeler après l'ajout de tous les aspects dynamiques
- Since:
- 4.2.0.0
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
acceptClass
(String name, byte[] classBytes, byte[] weavedBytes) protected void
protected Class
defineClass
(String name, byte[] b, CodeSource cs) Override to weave class using WeavingAdaptorvoid
URL[]
Implement method from WeavingClassLoaderprotected byte[]
Override to find classes generated by WeavingAdaptorvoid
prepare()
Mark classloader as configured with aspects and tell to prepare for weaving.Methods inherited from class org.aspectj.weaver.bcel.ExtensibleURLClassLoader
close, findClass
Methods inherited from class java.net.URLClassLoader
definePackage, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Field Details
-
WEAVING_CLASS_PATH
- See Also:
-
WEAVING_ASPECT_PATH
- See Also:
-
-
Constructor Details
-
AspectJUrlClassLoader
-
-
Method Details
-
addURL
- Overrides:
addURL
in classorg.aspectj.weaver.bcel.ExtensibleURLClassLoader
-
defineClass
Override to weave class using WeavingAdaptor- Overrides:
defineClass
in classorg.aspectj.weaver.bcel.ExtensibleURLClassLoader
- Throws:
IOException
-
getBytes
Override to find classes generated by WeavingAdaptor- Overrides:
getBytes
in classorg.aspectj.weaver.bcel.ExtensibleURLClassLoader
- Throws:
IOException
-
getAspectURLs
Implement method from WeavingClassLoader- Specified by:
getAspectURLs
in interfaceorg.aspectj.weaver.tools.WeavingClassLoader
-
acceptClass
- Specified by:
acceptClass
in interfaceorg.aspectj.weaver.tools.GeneratedClassHandler
-
deploy
-
prepare
public void prepare()Mark classloader as configured with aspects and tell to prepare for weaving. Must call this method to avoid NPE in aspectj weaver.
-