atjava.lang.annotation
Class AnnotatedBlock

java.lang.Object
  extended by atjava.lang.annotation.AnnotatedBlock

public class AnnotatedBlock
extends java.lang.Object

This class represents a part of code annotated by a Block Annotation.

In this example:
@MyBlockAnnotation("Declaration"){int a=1;}
the associated AnnotatedBlock will allow you to retrieve:


Method Summary
 boolean areBlockAnnotationsPresent()
          Returns true if there are AnnotatedBlocks nested in the AnnotatedBlock
 boolean areBlockAnnotationsPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
          Returns true if there are AnnotatedBlocks nested in the AnnotatedBlock having the specified type.
 boolean areBlockAnnotationsPresentAtSomeLevel(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
          Returns true if there are AnnotatedBlocks nested in the AnnotatedBlock having the specified type.
 boolean areExpressionAnnotationsPresent()
          Returns true if there are AnnotatedExpressions nested in the AnnotatedBlock
 boolean areExpressionAnnotationsPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
          Returns true if there are AnnotatedExpressions nested in the AnnotatedBlock having the specified type.
 boolean areExpressionAnnotationsPresentAtSomeLevel(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
          Returns true if there are ExpressionAnnotations nested in the AnnotatedBlock having the specified type.
 int endSourceColumn()
          The column number in the source code where the annotation ends
 int endSourceLine()
          The line number in the source code where the annotation ends
 AnnotatedBlock[] getAnnotatedBlocks()
          Returns all the AnnotatedBlocks that appears in the AnnotatedBlock (if any).
 AnnotatedBlock[] getAnnotatedBlocks(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
          Returns all the AnnotatedBlocks that appears in the AnnotatedBlock (if any) having the specified type.
 AnnotatedExpression[] getAnnotatedExpressions()
          Returns all the AnnotatedExpressions that appears in the AnnotatedBlock (if any)
 AnnotatedExpression[] getAnnotatedExpressions(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
          Returns all the AnnotatedExpressions that appears in the AnnotatedBlock (if any) having the specified type.
 java.lang.annotation.Annotation getAnnotation()
          Returns the annotation associated with the AnnotatedBlock
 java.lang.String getAnnotationType()
          Returns the type of the annotation of this AnnotatedBlock
 java.lang.annotation.Annotation[] getBlockAnnotations()
          Returns all the Annotations applied to the AnnotatedBlocks that appears in the AnnotatedBlock (if any).
<T extends java.lang.annotation.Annotation>
T[]
getBlockAnnotations(java.lang.Class<T> annotationClass)
          Returns all the Annotations applied to the AnnotatedBlocks that appears in the AnnotatedBlock (if any) having the specified type
Only the AnnotatedBlocks at level 0 (that is, not the nested ones) are taken in consideration.
 java.lang.String getBodySourceCode()
          Returns the source code associated with the AnnotatedBlock
 byte[] getBytecode()
          Returns the bytecode associated with the AnnotatedBlock
 java.lang.annotation.Annotation[] getExpressionAnnotations()
          Returns all the Annotations applied to the AnnotatedExpressions that appears in the AnnotatedBlock (if any).
<T extends java.lang.annotation.Annotation>
T[]
getExpressionAnnotations(java.lang.Class<T> annotationClass)
          Returns all the Annotations applied to the AnnotatedExpressions that appears in the AnnotatedBlock (if any) having the specified type
Only the AnnotatedExpressions at level 0 (that is, not the nested ones) are taken in consideration.
 int getLevel()
          Returns the level of this AnnotatedBlock
 java.lang.String getSourceCode()
          Returns the source code associated with the AnnotatedBlock
 int startSourceColumn()
          The column number in the source code where the annotation begins
 int startSourceLine()
          The line number in the source code where the annotation begins
 java.lang.String toBinBytecodeString()
          Converts the AnnotatedBlock to a String containing the binary representation of the bytecode annotated
 java.lang.String toHexBytecodeString()
          Converts the AnnotatedBlock to a String containing the hexadecimal representation of the bytecode annotated
 java.lang.String toIntBytecodeString()
          Converts the AnnotatedBlock to a String containing the decimal representation of the bytecode annotated
 java.lang.String toString()
          Converts the AnnotatedBlock to a String
 java.lang.String toStringWithInnerAnnotatedBlockAndExpression()
          Converts the AnnotatedBlock to a String including the list of the Block and Expression Annotation that it contains (if any)
 java.lang.String toSymBytecodeString()
          Converts the AnnotatedBlock to a String containing the symbolic representation of the bytecode annotated
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

startSourceLine

public int startSourceLine()
The line number in the source code where the annotation begins


startSourceColumn

public int startSourceColumn()
The column number in the source code where the annotation begins


endSourceLine

public int endSourceLine()
The line number in the source code where the annotation ends


endSourceColumn

public int endSourceColumn()
The column number in the source code where the annotation ends


getBlockAnnotations

public java.lang.annotation.Annotation[] getBlockAnnotations()
Returns all the Annotations applied to the AnnotatedBlocks that appears in the AnnotatedBlock (if any).
Only the AnnotatedBlocks at level 0 (that is, not the nested ones) are taken in consideration.

Returns:
an array of Annotation

getBlockAnnotations

public <T extends java.lang.annotation.Annotation> T[] getBlockAnnotations(java.lang.Class<T> annotationClass)
Returns all the Annotations applied to the AnnotatedBlocks that appears in the AnnotatedBlock (if any) having the specified type
Only the AnnotatedBlocks at level 0 (that is, not the nested ones) are taken in consideration.

Returns:
an array of annotation of type T

areBlockAnnotationsPresent

public boolean areBlockAnnotationsPresent()
Returns true if there are AnnotatedBlocks nested in the AnnotatedBlock


areBlockAnnotationsPresent

public boolean areBlockAnnotationsPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Returns true if there are AnnotatedBlocks nested in the AnnotatedBlock having the specified type.
Only the AnnotatedBlocks at level 0 (that is, not the nested ones) are taken in consideration.

Parameters:
annotationClass - the desired type of Annotation

areBlockAnnotationsPresentAtSomeLevel

public boolean areBlockAnnotationsPresentAtSomeLevel(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Returns true if there are AnnotatedBlocks nested in the AnnotatedBlock having the specified type.
AnnotatedBlocks at any level are taken in consideration (that is, nested AnnotatedBlocks too).

Parameters:
annotationClass - the desired type of Annotation

getExpressionAnnotations

public java.lang.annotation.Annotation[] getExpressionAnnotations()
Returns all the Annotations applied to the AnnotatedExpressions that appears in the AnnotatedBlock (if any).
Only the AnnotatedExpressions at level 0 (that is, not the nested ones) are taken in consideration.

Returns:
an array of Annotation

getExpressionAnnotations

public <T extends java.lang.annotation.Annotation> T[] getExpressionAnnotations(java.lang.Class<T> annotationClass)
Returns all the Annotations applied to the AnnotatedExpressions that appears in the AnnotatedBlock (if any) having the specified type
Only the AnnotatedExpressions at level 0 (that is, not the nested ones) are taken in consideration.

Returns:
an array of annotation of type T

areExpressionAnnotationsPresent

public boolean areExpressionAnnotationsPresent()
Returns true if there are AnnotatedExpressions nested in the AnnotatedBlock


areExpressionAnnotationsPresent

public boolean areExpressionAnnotationsPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Returns true if there are AnnotatedExpressions nested in the AnnotatedBlock having the specified type.
Only the AnnotatedExpressions at level 0 (that is, not the nested ones) are taken in consideration.

Parameters:
annotationClass - the desired type of Annotation

areExpressionAnnotationsPresentAtSomeLevel

public boolean areExpressionAnnotationsPresentAtSomeLevel(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Returns true if there are ExpressionAnnotations nested in the AnnotatedBlock having the specified type.
ExpressionAnnotation at any level are taken in consideration (that is, nested ExpressionAnnotation too).

Parameters:
annotationClass - the desired type of Annotation

getAnnotatedBlocks

public AnnotatedBlock[] getAnnotatedBlocks()
Returns all the AnnotatedBlocks that appears in the AnnotatedBlock (if any).

Returns:
an array of AnnotatedBlocks

getAnnotatedBlocks

public AnnotatedBlock[] getAnnotatedBlocks(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Returns all the AnnotatedBlocks that appears in the AnnotatedBlock (if any) having the specified type.

Parameters:
annotationClass - the desired type of Annotation
Returns:
an array of AnnotatedBlocks

getAnnotatedExpressions

public AnnotatedExpression[] getAnnotatedExpressions()
Returns all the AnnotatedExpressions that appears in the AnnotatedBlock (if any)

Returns:
an array of AnnotatedExpression

getAnnotatedExpressions

public AnnotatedExpression[] getAnnotatedExpressions(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Returns all the AnnotatedExpressions that appears in the AnnotatedBlock (if any) having the specified type.

Parameters:
annotationClass - the desired type of Annotation
Returns:
an array of AnnotatedBlocks

getBytecode

public byte[] getBytecode()
Returns the bytecode associated with the AnnotatedBlock

Returns:
A byte array representing the bytecode

getAnnotation

public java.lang.annotation.Annotation getAnnotation()
Returns the annotation associated with the AnnotatedBlock

Returns:
the annotation associated with the AnnotatedBlock

getSourceCode

public java.lang.String getSourceCode()
                               throws SourceNotAvailableException,
                                      InvalidReferenceException
Returns the source code associated with the AnnotatedBlock


getBodySourceCode

public java.lang.String getBodySourceCode()
                                   throws SourceNotAvailableException,
                                          InvalidReferenceException
Returns the source code associated with the AnnotatedBlock


getLevel

public int getLevel()
Returns the level of this AnnotatedBlock

Returns:
the level of this AnnotatedBlock

getAnnotationType

public java.lang.String getAnnotationType()
Returns the type of the annotation of this AnnotatedBlock

Returns:
the type of the annotation

toString

public java.lang.String toString()
Converts the AnnotatedBlock to a String

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object.

toStringWithInnerAnnotatedBlockAndExpression

public java.lang.String toStringWithInnerAnnotatedBlockAndExpression()
Converts the AnnotatedBlock to a String including the list of the Block and Expression Annotation that it contains (if any)


toBinBytecodeString

public java.lang.String toBinBytecodeString()
Converts the AnnotatedBlock to a String containing the binary representation of the bytecode annotated


toIntBytecodeString

public java.lang.String toIntBytecodeString()
Converts the AnnotatedBlock to a String containing the decimal representation of the bytecode annotated


toHexBytecodeString

public java.lang.String toHexBytecodeString()
Converts the AnnotatedBlock to a String containing the hexadecimal representation of the bytecode annotated


toSymBytecodeString

public java.lang.String toSymBytecodeString()
Converts the AnnotatedBlock to a String containing the symbolic representation of the bytecode annotated