org.aspectj.weaver
Class WeaverStateInfo

java.lang.Object
  extended by org.aspectj.weaver.WeaverStateInfo

public class WeaverStateInfo
extends java.lang.Object

WeaverStateInfo represents how a type was processed. It is used by the weaver to determine how a type was previously treated and whether reweaving is allowed. The format in the data stream is: Byte: Kind. UNTOUCHED|WOVEN|EXTENDED - If extended it can have two extra bits set 'REWEAVABLE' and 'REWEAVABLE_COMPRESSION_BIT' Short: typeMungerCount - how many type mungers have affected this type : The type mungers themselves If we are reweavable then we also have: Short: Number of aspects that touched this type in some way when it was previously woven The fully qualified name of each type Int: Length of class file data (i.e. the unwovenclassfile) Byte[]: The class file data, compressed if REWEAVABLE_COMPRESSION_BIT set.


Constructor Summary
WeaverStateInfo(boolean reweavable)
           
 
Method Summary
 void addAspectAffectingType(java.lang.String aspectSignature)
           
 void addAspectsAffectingType(java.util.Collection<java.lang.String> aspects)
           
 void addConcreteMunger(ConcreteTypeMunger munger)
           
 java.util.Set<java.lang.String> getAspectsAffectingType()
           
 java.util.List<ConcreteTypeMunger> getTypeMungers(ResolvedType onType)
           
 byte[] getUnwovenClassFileData(byte[] wovenClassFile)
           
 boolean isAspectAlreadyApplied(ResolvedType someAspect)
           
 boolean isOldStyle()
           
 boolean isReweavable()
           
static WeaverStateInfo read(VersionedDataInputStream s, ISourceContext context)
          See comments on write()
 byte[] replaceKeyWithDiff(byte[] wovenClassFile)
          Here is the cleverness for reweavable diff mode.
 void setReweavable(boolean rw)
           
static void setReweavableModeDefaults(boolean mode, boolean compress, boolean diff)
           
 void setUnwovenClassFileData(byte[] data)
           
 java.lang.String toString()
           
 void write(CompressingDataOutputStream s)
          Serialize the WeaverStateInfo.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WeaverStateInfo

public WeaverStateInfo(boolean reweavable)
Method Detail

setReweavableModeDefaults

public static void setReweavableModeDefaults(boolean mode,
                                             boolean compress,
                                             boolean diff)

read

public static final WeaverStateInfo read(VersionedDataInputStream s,
                                         ISourceContext context)
                                  throws java.io.IOException
See comments on write()

Throws:
java.io.IOException

write

public void write(CompressingDataOutputStream s)
           throws java.io.IOException
Serialize the WeaverStateInfo. Various bits are set within the 'kind' flag to indicate the structure of the attribute. In reweavable diff mode a 'marker' is inserted at the start of the attribute to indicate where the final calculated diff should be inserted. When the key is replaced with the diff, the 'kind' byte moves to the front of the attribute - thats why in the read logic you'll see it expecting the kind as the first byte.

Throws:
java.io.IOException

addConcreteMunger

public void addConcreteMunger(ConcreteTypeMunger munger)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getTypeMungers

public java.util.List<ConcreteTypeMunger> getTypeMungers(ResolvedType onType)

isOldStyle

public boolean isOldStyle()

getUnwovenClassFileData

public byte[] getUnwovenClassFileData(byte[] wovenClassFile)

setUnwovenClassFileData

public void setUnwovenClassFileData(byte[] data)

isReweavable

public boolean isReweavable()

setReweavable

public void setReweavable(boolean rw)

addAspectsAffectingType

public void addAspectsAffectingType(java.util.Collection<java.lang.String> aspects)

addAspectAffectingType

public void addAspectAffectingType(java.lang.String aspectSignature)

getAspectsAffectingType

public java.util.Set<java.lang.String> getAspectsAffectingType()

replaceKeyWithDiff

public byte[] replaceKeyWithDiff(byte[] wovenClassFile)
Here is the cleverness for reweavable diff mode. The class file on disk contains, inside the weaverstateinfo attribute, a diff that can be applied to 'itself' to recover the original class - which can then be rewoven.


isAspectAlreadyApplied

public boolean isAspectAlreadyApplied(ResolvedType someAspect)
Returns:
true if the supplied aspect is already in the list of those affecting this type