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. |
void |
failure(FormatterTreeUtil.Result<?> res,
@CompilerMessageKey String msgKey,
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) |
void |
warning(FormatterTreeUtil.Result<?> res,
@CompilerMessageKey String msgKey,
Object... args)
Reports a 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 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 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)