public class FormatterTreeUtil extends Object
| Modifier and Type | Class and Description | 
|---|---|
| class  | FormatterTreeUtil.FormatCallRepresents a format method invocation in the syntax tree. | 
| static class  | FormatterTreeUtil.InvocationTypeDescribes the ways a format method may be invoked. | 
| static class  | FormatterTreeUtil.Result<E>A wrapper around a value of type E, plus an ExpressionTree location. | 
| Modifier and Type | Field and Description | 
|---|---|
| BaseTypeChecker | checkerThe checker. | 
| protected ExecutableElement | formatValueElementThe value() element/field of an @Format annotation. | 
| protected ExecutableElement | invalidFormatValueElementThe value() element/field of an @InvalidFormat annotation. | 
| ProcessingEnvironment | processingEnvThe processing environment. | 
| Constructor and Description | 
|---|
| FormatterTreeUtil(BaseTypeChecker checker) | 
| Modifier and Type | Method and Description | 
|---|---|
| FormatterTreeUtil.Result<ConversionCategory[]> | asFormatCallCategories(MethodInvocationNode node) | 
| AnnotationMirror | categoriesToFormatAnnotation(ConversionCategory[] args)Creates a  @Formatannotation with the given list as its value. | 
| @Nullable FormatterTreeUtil.FormatCall | create(MethodInvocationTree invocationTree,
      AnnotatedTypeFactory atypeFactory)Creates a new FormatCall, or returns null. | 
| AnnotationMirror | exceptionToInvalidFormatAnnotation(IllegalFormatException ex)Takes an exception that describes an invalid formatter string and, returns a syntax trees
 element that represents a  InvalidFormatannotation with the exception's error message
 as value. | 
| void | failure(FormatterTreeUtil.Result<?> res,
       @CompilerMessageKey String msgKey,
       Object... args)Reports an error. | 
| ConversionCategory[] | formatAnnotationToCategories(AnnotationMirror anno)Returns the value of a  @Formatannotation. | 
| String | invalidFormatAnnotationToErrorMessage(AnnotationMirror anno)Takes a syntax tree element that represents a  InvalidFormatannotation, and returns its
 value. | 
| boolean | isAsFormatCall(MethodInvocationNode node,
              AnnotatedTypeFactory atypeFactory)Returns true if the call is to a method with the @ReturnsFormat annotation. | 
| boolean | isFormatMethodCall(MethodInvocationTree node,
                  AnnotatedTypeFactory atypeFactory)Returns true if  nodeis a call to a method annotated with@FormatMethod. | 
| void | warning(FormatterTreeUtil.Result<?> res,
       @CompilerMessageKey String msgKey,
       Object... args)Reports a warning. | 
public final BaseTypeChecker checker
public final ProcessingEnvironment processingEnv
protected final ExecutableElement formatValueElement
protected final ExecutableElement invalidFormatValueElement
public FormatterTreeUtil(BaseTypeChecker checker)
public boolean isAsFormatCall(MethodInvocationNode node, AnnotatedTypeFactory atypeFactory)
public FormatterTreeUtil.Result<ConversionCategory[]> asFormatCallCategories(MethodInvocationNode node)
public boolean isFormatMethodCall(MethodInvocationTree node, AnnotatedTypeFactory atypeFactory)
node is a call to a method annotated with @FormatMethod.node - a method callatypeFactory - a type factorynode is a call to a method annotated with @FormatMethodpublic @Nullable FormatterTreeUtil.FormatCall create(MethodInvocationTree invocationTree, AnnotatedTypeFactory atypeFactory)
invocationTree - a method invocation, where the method is annotated @FormatMethodatypeFactory - the type factorypublic final void failure(FormatterTreeUtil.Result<?> res, @CompilerMessageKey String msgKey, Object... args)
res - used for source location informationmsgKey - the diagnostic message keyargs - arguments to the diagnostic messagepublic final void warning(FormatterTreeUtil.Result<?> res, @CompilerMessageKey String msgKey, Object... args)
res - used for source location informationmsgKey - the diagnostic message keyargs - arguments to the diagnostic messagepublic AnnotationMirror exceptionToInvalidFormatAnnotation(IllegalFormatException ex)
InvalidFormat annotation with the exception's error message
 as value.public String invalidFormatAnnotationToErrorMessage(AnnotationMirror anno)
InvalidFormat annotation, and returns its
 value.anno - an InvalidFormat annotationpublic AnnotationMirror categoriesToFormatAnnotation(ConversionCategory[] args)
@Format annotation with the given list as its value.args - conversion categories for the @Format annotation@Format annotation with the given list as its valuepublic ConversionCategory[] formatAnnotationToCategories(AnnotationMirror anno)
@Format annotation.anno - a @Format annotationvalue element