public class I18nFormatterTreeUtil
extends java.lang.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 |
javax.annotation.processing.ProcessingEnvironment |
processingEnv |
Constructor and Description |
---|
I18nFormatterTreeUtil(BaseTypeChecker checker) |
Modifier and Type | Method and Description |
---|---|
javax.lang.model.element.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(com.sun.source.tree.MethodInvocationTree tree,
MethodInvocationNode node,
I18nFormatterAnnotatedTypeFactory atypeFactory)
Returns an I18nFormatCall instance, only if FormatFor is called.
|
javax.lang.model.element.AnnotationMirror |
exceptionToInvalidFormatAnnotation(java.lang.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 java.lang.String msg,
java.lang.Object... args)
Reports an error.
|
I18nConversionCategory[] |
formatAnnotationToCategories(javax.lang.model.element.AnnotationMirror anno)
Takes a syntax tree element that represents a
I18nFormat annotation, and returns its
value. |
FormatterTreeUtil.Result<I18nConversionCategory[]> |
getHasFormatCallCategories(MethodInvocationNode node) |
java.lang.String |
invalidFormatAnnotationToErrorMessage(javax.lang.model.element.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 java.lang.String msg,
java.lang.Object... args)
Reports an warning.
|
public final BaseTypeChecker checker
public final javax.annotation.processing.ProcessingEnvironment processingEnv
public I18nFormatterTreeUtil(BaseTypeChecker checker)
public javax.lang.model.element.AnnotationMirror exceptionToInvalidFormatAnnotation(java.lang.IllegalArgumentException ex)
I18nInvalidFormat
annotation with the exception's error
message as value.public java.lang.String invalidFormatAnnotationToErrorMessage(javax.lang.model.element.AnnotationMirror anno)
I18nInvalidFormat
annotation, and
returns its value.public javax.lang.model.element.AnnotationMirror categoriesToFormatAnnotation(I18nConversionCategory[] args)
I18nFormat
annotation with the list as value.public I18nConversionCategory[] formatAnnotationToCategories(javax.lang.model.element.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 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 FormatterTreeUtil.Result<I18nConversionCategory[]> getHasFormatCallCategories(MethodInvocationNode node)
public FormatterTreeUtil.Result<I18nConversionCategory[]> makeFormatCallCategories(MethodInvocationNode node, I18nFormatterAnnotatedTypeFactory atypeFactory)
public I18nFormatterTreeUtil.I18nFormatCall createFormatForCall(com.sun.source.tree.MethodInvocationTree tree, MethodInvocationNode node, I18nFormatterAnnotatedTypeFactory atypeFactory)