public class I18nFormatterTreeUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
I18nFormatterTreeUtil.FormatType
Describe the format annotation type.
|
class |
I18nFormatterTreeUtil.I18nFormatCall
Represents a format method invocation in the syntax tree.
|
Modifier and Type | Field and Description |
---|---|
BaseTypeChecker |
checker |
ProcessingEnvironment |
processingEnv |
Constructor and Description |
---|
I18nFormatterTreeUtil(BaseTypeChecker checker) |
Modifier and Type | Method and Description |
---|---|
AnnotationMirror |
categoriesToFormatAnnotation(I18nConversionCategory[] args)
Takes a list of ConversionCategory elements, and returns a syntax tree element that
represents a
I18nFormat annotation with the list as value. |
I18nFormatterTreeUtil.I18nFormatCall |
createFormatForCall(MethodInvocationTree tree,
MethodInvocationNode node,
I18nFormatterAnnotatedTypeFactory atypeFactory)
Returns an I18nFormatCall instance, only if FormatFor is called.
|
AnnotationMirror |
exceptionToInvalidFormatAnnotation(IllegalArgumentException ex)
Takes an exception that describes an invalid formatter string and returns a syntax trees
element that represents a
I18nInvalidFormat annotation with the exception's error
message as value. |
<E> void |
failure(FormatterTreeUtil.Result<E> res,
@CompilerMessageKey String msg,
Object... args)
Reports an error.
|
I18nConversionCategory[] |
formatAnnotationToCategories(AnnotationMirror anno)
Takes a syntax tree element that represents a
I18nFormat annotation, and returns its
value. |
FormatterTreeUtil.Result<I18nConversionCategory[]> |
getHasFormatCallCategories(MethodInvocationNode node) |
String |
invalidFormatAnnotationToErrorMessage(AnnotationMirror anno)
Takes a syntax tree element that represents a
I18nInvalidFormat annotation, and
returns its value. |
boolean |
isHasFormatCall(MethodInvocationNode node,
AnnotatedTypeFactory atypeFactory)
Returns true if the call is to a method with the @I18nChecksFormat annotation.
|
boolean |
isIsFormatCall(MethodInvocationNode node,
AnnotatedTypeFactory atypeFactory)
Returns true if the call is to a method with the @I18nValidFormat annotation.
|
boolean |
isMakeFormatCall(MethodInvocationNode node,
AnnotatedTypeFactory atypeFactory)
Returns true if the call is to a method with the @I18nMakeFormat annotation.
|
FormatterTreeUtil.Result<I18nConversionCategory[]> |
makeFormatCallCategories(MethodInvocationNode node,
I18nFormatterAnnotatedTypeFactory atypeFactory) |
<E> void |
warning(FormatterTreeUtil.Result<E> res,
@CompilerMessageKey String msg,
Object... args)
Reports an warning.
|
public final BaseTypeChecker checker
public final ProcessingEnvironment processingEnv
public I18nFormatterTreeUtil(BaseTypeChecker checker)
public AnnotationMirror exceptionToInvalidFormatAnnotation(IllegalArgumentException ex)
I18nInvalidFormat
annotation with the exception's error
message as value.public String invalidFormatAnnotationToErrorMessage(AnnotationMirror anno)
I18nInvalidFormat
annotation, and
returns its value.public AnnotationMirror categoriesToFormatAnnotation(I18nConversionCategory[] args)
I18nFormat
annotation with the list as value.public I18nConversionCategory[] formatAnnotationToCategories(AnnotationMirror anno)
I18nFormat
annotation, and returns its
value.public boolean isHasFormatCall(MethodInvocationNode node, AnnotatedTypeFactory atypeFactory)
public boolean isIsFormatCall(MethodInvocationNode node, AnnotatedTypeFactory atypeFactory)
public boolean isMakeFormatCall(MethodInvocationNode node, AnnotatedTypeFactory atypeFactory)
public final <E> void failure(FormatterTreeUtil.Result<E> res, @CompilerMessageKey String msg, Object... args)
FormatterTreeUtil.Result
to report the location.public final <E> void warning(FormatterTreeUtil.Result<E> res, @CompilerMessageKey String msg, Object... args)
FormatterTreeUtil.Result
to report the location.public FormatterTreeUtil.Result<I18nConversionCategory[]> getHasFormatCallCategories(MethodInvocationNode node)
public FormatterTreeUtil.Result<I18nConversionCategory[]> makeFormatCallCategories(MethodInvocationNode node, I18nFormatterAnnotatedTypeFactory atypeFactory)
public I18nFormatterTreeUtil.I18nFormatCall createFormatForCall(MethodInvocationTree tree, MethodInvocationNode node, I18nFormatterAnnotatedTypeFactory atypeFactory)