@SupportedOptions(value="generatedTranslationFilesPath") final class TranslationFileGenerator extends AbstractGenerator
Modifier and Type | Class and Description |
---|---|
private static class |
TranslationFileGenerator.LevelComparator |
Modifier and Type | Field and Description |
---|---|
private TranslationFileGenerator.LevelComparator |
comparator |
private static java.lang.String |
DEFAULT_FILE_COMMENT |
static java.lang.String |
DEFAULT_FILE_EXTENSION |
static java.lang.String |
EMPTY_STRING |
static java.lang.String |
GENERATED_FILE_EXTENSION |
static java.lang.String |
GENERATED_FILES_PATH_OPTION |
private java.lang.String |
generatedFilesPath |
static java.lang.String |
JAVA_DOC_PARAM |
static java.lang.String |
LEVEL_OPTION |
private static java.util.Map<java.lang.String,java.lang.Integer> |
levels |
private static java.util.regex.Pattern |
PATTERN |
Constructor and Description |
---|
TranslationFileGenerator(javax.annotation.processing.ProcessingEnvironment processingEnv)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
generateDefaultTranslationFile(MessageInterface messageInterface)
Generates a default i18n properties file.
|
(package private) void |
generateSkeletalTranslationFile(java.lang.String relativePath,
java.lang.String fileName,
MessageInterface messageInterface)
Generate the translation file containing the given
translations.
|
private boolean |
isMethodWritable(MessageMethod method) |
private java.util.Map<java.lang.String,java.lang.String> |
parseParameterComments(MessageMethod messageMethod) |
void |
processTypeElement(javax.lang.model.element.TypeElement annotation,
javax.lang.model.element.TypeElement element,
MessageInterface messageInterface)
Processes a type element.
|
private void |
writeSkeletonMessageMethod(java.io.BufferedWriter writer,
MessageMethod messageMethod) |
elementUtils, filer, getName, getSupportedOptions, logger, processingEnv, typeUtils
private static final java.util.Map<java.lang.String,java.lang.Integer> levels
private static final java.util.regex.Pattern PATTERN
public static final java.lang.String EMPTY_STRING
public static final java.lang.String JAVA_DOC_PARAM
public static final java.lang.String GENERATED_FILES_PATH_OPTION
public static final java.lang.String LEVEL_OPTION
public static final java.lang.String GENERATED_FILE_EXTENSION
public static final java.lang.String DEFAULT_FILE_EXTENSION
private static final java.lang.String DEFAULT_FILE_COMMENT
private final java.lang.String generatedFilesPath
private final TranslationFileGenerator.LevelComparator comparator
public TranslationFileGenerator(javax.annotation.processing.ProcessingEnvironment processingEnv)
processingEnv
- the processing envpublic void processTypeElement(javax.lang.model.element.TypeElement annotation, javax.lang.model.element.TypeElement element, MessageInterface messageInterface)
AbstractGenerator
processTypeElement
in class AbstractGenerator
annotation
- the annotation who trigger the processingelement
- the element that contains the methods.messageInterface
- the message interface to implement.void generateSkeletalTranslationFile(java.lang.String relativePath, java.lang.String fileName, MessageInterface messageInterface)
relativePath
- the relative pathfileName
- the file namemessageInterface
- the message interfaceprivate void generateDefaultTranslationFile(MessageInterface messageInterface)
messageInterface
- the message interfaceprivate void writeSkeletonMessageMethod(java.io.BufferedWriter writer, MessageMethod messageMethod) throws java.io.IOException
java.io.IOException
private java.util.Map<java.lang.String,java.lang.String> parseParameterComments(MessageMethod messageMethod) throws java.io.IOException
java.io.IOException
private boolean isMethodWritable(MessageMethod method)