List of usage examples for org.aspectj.weaver IUnwovenClassFile getBytes
byte[] getBytes();
From source file:org.eclipse.equinox.weaving.aspectj.loadtime.OSGiWeavingAdaptor.java
License:Open Source License
/** * In some situations the weaving creates new classes on the fly that are * not part of the original bundle. This is the case when the weaver needs * to create closure-like constructs for the woven code. * //from w w w . j a v a2s .com * This method returns a map of the generated classes (name -> bytecode) and * flushes the internal cache afterwards to avoid memory damage over time. * * @param className The name of the class for which additional classes might * got generated * @return the map of generated class names and bytecodes for those * generated classes */ public Map<String, byte[]> getGeneratedClassesFor(final String className) { final Map<?, ?> generated = this.generatedClasses; final Map<String, byte[]> result = new HashMap<String, byte[]>(); final Iterator<?> generatedClassNames = generated.keySet().iterator(); while (generatedClassNames.hasNext()) { final String name = (String) generatedClassNames.next(); final IUnwovenClassFile unwovenClass = (IUnwovenClassFile) generated.get(name); if (!className.equals(name)) { result.put(name, unwovenClass.getBytes()); } } flushGeneratedClasses(); return result; }