public class FormatterTreeUtil
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
FormatterTreeUtil.FormatCall
Represents a format method invocation in the syntax tree.
|
static class |
FormatterTreeUtil.InvocationType
Describes 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 |
checker |
javax.annotation.processing.ProcessingEnvironment |
processingEnv |
Constructor and Description |
---|
FormatterTreeUtil(BaseTypeChecker checker) |
Modifier and Type | Method and Description |
---|---|
FormatterTreeUtil.Result<ConversionCategory[]> |
asFormatCallCategories(MethodInvocationNode node) |
javax.lang.model.element.AnnotationMirror |
categoriesToFormatAnnotation(ConversionCategory[] args)
Takes a list of ConversionCategory elements, and returns a syntax tree element that
represents a
Format annotation with the list as value. |
javax.lang.model.element.AnnotationMirror |
exceptionToInvalidFormatAnnotation(java.util.IllegalFormatException ex)
Takes an exception that describes an invalid formatter string and, returns a syntax trees
element that represents a
InvalidFormat annotation with the exception's error message
as value. |
<E> void |
failure(FormatterTreeUtil.Result<E> res,
@CompilerMessageKey java.lang.String msg,
java.lang.Object... args)
Reports an error.
|
ConversionCategory[] |
formatAnnotationToCategories(javax.lang.model.element.AnnotationMirror anno)
Takes a syntax tree element that represents a
Format annotation, and returns its
value. |
java.lang.String |
invalidFormatAnnotationToErrorMessage(javax.lang.model.element.AnnotationMirror anno)
Takes a syntax tree element that represents a
InvalidFormat annotation, and returns
its value. |
boolean |
isAsFormatCall(MethodInvocationNode node,
AnnotatedTypeFactory atypeFactory) |
boolean |
isFormatCall(com.sun.source.tree.MethodInvocationTree node,
AnnotatedTypeFactory atypeFactory)
Returns true if
node is a call to a method annotated with @FormatMethod . |
static boolean |
isLocale(com.sun.source.tree.ExpressionTree e,
AnnotatedTypeFactory atypeFactory)
Returns true if the given ExpressionTree has type java.util.Locale.
|
<E> void |
warning(FormatterTreeUtil.Result<E> res,
@CompilerMessageKey java.lang.String msg,
java.lang.Object... args)
Reports an warning.
|
public final BaseTypeChecker checker
public final javax.annotation.processing.ProcessingEnvironment processingEnv
public FormatterTreeUtil(BaseTypeChecker checker)
public boolean isAsFormatCall(MethodInvocationNode node, AnnotatedTypeFactory atypeFactory)
public FormatterTreeUtil.Result<ConversionCategory[]> asFormatCallCategories(MethodInvocationNode node)
public boolean isFormatCall(com.sun.source.tree.MethodInvocationTree node, AnnotatedTypeFactory atypeFactory)
node
is a call to a method annotated with @FormatMethod
.public static boolean isLocale(com.sun.source.tree.ExpressionTree e, AnnotatedTypeFactory atypeFactory)
public final <E> void failure(FormatterTreeUtil.Result<E> res, @CompilerMessageKey java.lang.String msg, java.lang.Object... args)
FormatterTreeUtil.Result
to report the location.public final <E> void warning(FormatterTreeUtil.Result<E> res, @CompilerMessageKey java.lang.String msg, java.lang.Object... args)
FormatterTreeUtil.Result
to report the location.public javax.lang.model.element.AnnotationMirror exceptionToInvalidFormatAnnotation(java.util.IllegalFormatException ex)
InvalidFormat
annotation with the exception's error message
as value.public java.lang.String invalidFormatAnnotationToErrorMessage(javax.lang.model.element.AnnotationMirror anno)
InvalidFormat
annotation, and returns
its value.public javax.lang.model.element.AnnotationMirror categoriesToFormatAnnotation(ConversionCategory[] args)
Format
annotation with the list as value.public ConversionCategory[] formatAnnotationToCategories(javax.lang.model.element.AnnotationMirror anno)
Format
annotation, and returns its
value.