checkers.typestate
Class TypestateUtil
java.lang.Object
checkers.typestate.TypestateUtil
public class TypestateUtil
- extends java.lang.Object
- Author:
- Adam Warski (adam at warski dot org)
|
Constructor Summary |
TypestateUtil(javax.annotation.processing.ProcessingEnvironment env)
|
|
Method Summary |
boolean |
anyAnnotationCovers(javax.lang.model.element.AnnotationMirror anyAnnotation,
java.util.Set<javax.lang.model.element.AnnotationMirror> actualAnnotations)
|
java.util.Set<javax.lang.model.element.AnnotationMirror> |
filterStateAnnotations(java.util.Set<javax.lang.model.element.AnnotationMirror> annotations)
|
javax.lang.model.element.AnnotationMirror |
getAfterParameterValue(javax.lang.model.element.AnnotationMirror stateAnnotation)
|
javax.lang.model.element.AnnotationMirror |
getExceptionParameterValue(javax.lang.model.element.AnnotationMirror stateAnnotation)
|
java.util.List<javax.lang.model.element.AnnotationMirror> |
getExceptParameterValue(javax.lang.model.element.AnnotationMirror anyStateAnnotation)
|
boolean |
isAnyStateAnnotation(javax.lang.model.element.AnnotationMirror annotation)
|
boolean |
isStateAnnotation(javax.lang.model.element.AnnotationMirror annotation)
|
boolean |
isStateAnnotation(javax.lang.model.type.DeclaredType dt)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TRANSITION_ELEMENT_NAME
public static final java.lang.String TRANSITION_ELEMENT_NAME
- See Also:
- Constant Field Values
EXCEPT_ELEMENT_NAME
public static final java.lang.String EXCEPT_ELEMENT_NAME
- See Also:
- Constant Field Values
EXCEPTION_ELEMENT_NAME
public static final java.lang.String EXCEPTION_ELEMENT_NAME
- See Also:
- Constant Field Values
TypestateUtil
public TypestateUtil(javax.annotation.processing.ProcessingEnvironment env)
isAnyStateAnnotation
public boolean isAnyStateAnnotation(javax.lang.model.element.AnnotationMirror annotation)
- Parameters:
annotation - Annotation to check.
- Returns:
- True iff the given annotation is the any state annotation (@
Any)
anyAnnotationCovers
public boolean anyAnnotationCovers(javax.lang.model.element.AnnotationMirror anyAnnotation,
java.util.Set<javax.lang.model.element.AnnotationMirror> actualAnnotations)
getExceptParameterValue
@Nullable
public java.util.List<javax.lang.model.element.AnnotationMirror> getExceptParameterValue(javax.lang.model.element.AnnotationMirror anyStateAnnotation)
- Parameters:
anyStateAnnotation - Any-state annotation from which to read the "except" parameter.
- Returns:
- The set of annotations representing the value of the "except" parameter of the given annotation or null,
if the parameter is not specified.
isStateAnnotation
public boolean isStateAnnotation(javax.lang.model.type.DeclaredType dt)
- Parameters:
dt - Type to check.
- Returns:
- True iff the given type is a state annotation, that is, is itself annotated with
\@
State.
isStateAnnotation
public boolean isStateAnnotation(javax.lang.model.element.AnnotationMirror annotation)
- Parameters:
annotation - Annotation to check.
- Returns:
- True iff the given annotation is a state annotation, that is, is itself annotated with
\@
State.
getAfterParameterValue
@Nullable
public javax.lang.model.element.AnnotationMirror getAfterParameterValue(javax.lang.model.element.AnnotationMirror stateAnnotation)
- Parameters:
stateAnnotation - State annotation from which to read the "after" parameter.
- Returns:
- The state annotation representing the value of the "after" element of the given annotation or null,
if the element is not specified or is not a (state) annotation.
getExceptionParameterValue
@Nullable
public javax.lang.model.element.AnnotationMirror getExceptionParameterValue(javax.lang.model.element.AnnotationMirror stateAnnotation)
- Parameters:
stateAnnotation - State annotation from which to read the "onException" parameter.
- Returns:
- The state annotation representing the value of the "after" element of the given annotation or null,
if the element is not specified or is not a (state) annotation.
filterStateAnnotations
public java.util.Set<javax.lang.model.element.AnnotationMirror> filterStateAnnotations(java.util.Set<javax.lang.model.element.AnnotationMirror> annotations)
- Parameters:
annotations - Set of annotations to filter.
- Returns:
- A set of annotation mirrors containing all state annotations from the given set.