Package org.jboss.logging.processor.apt
Class TranslationFileGenerator
java.lang.Object
org.jboss.logging.processor.apt.AbstractGenerator
org.jboss.logging.processor.apt.TranslationFileGenerator
@SupportedOptions({"generatedTranslationFilesPath","org.jboss.logging.tools.level","org.jboss.logging.tools.generated.skip.index"})
final class TranslationFileGenerator
extends AbstractGenerator
The generator of skeletal
translations files.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TranslationFileGenerator.LevelComparator
private static final String
private static final String
private static final String
(package private) static final String
(package private) static final String
private final String
private static final String
(package private) static final String
private static final Pattern
(package private) static final String
private final boolean
Fields inherited from class org.jboss.logging.processor.apt.AbstractGenerator
processingEnv
-
Constructor Summary
ConstructorsConstructorDescriptionTranslationFileGenerator
(ProcessingEnvironment processingEnv) The constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate String
addIndexesToFormat
(MessageMethod method) private void
generateDefaultTranslationFile
(MessageInterface messageInterface) Generates a default i18n properties file.private void
generateSkeletalTranslationFile
(String relativePath, String fileName, MessageInterface messageInterface) Generate the translation file containing the given translations.private static String
getPrimaryClassNamePrefix
(TypeElement element) Returns the primary class simple name prefix for an element who represents a MessageBundle or MessageLogger interface.private boolean
isMethodWritable
(MessageMethod method) parseParameterComments
(MessageMethod messageMethod) void
processTypeElement
(TypeElement annotation, TypeElement element, MessageInterface messageInterface) Processes a type element.private static void
writeSeparatorLine
(BufferedWriter writer) private void
writeSkeletonMessageMethod
(BufferedWriter writer, MessageMethod messageMethod) Methods inherited from class org.jboss.logging.processor.apt.AbstractGenerator
getName, getSupportedOptions, logger
-
Field Details
-
levels
-
PATTERN
-
EMPTY_STRING
- See Also:
-
JAVA_DOC_PARAM
- See Also:
-
DEFAULT_FILE_EXTENSION
- See Also:
-
DEFAULT_FILE_COMMENT
- See Also:
-
GENERATED_FILES_PATH_OPTION
- See Also:
-
GENERATED_FILE_EXTENSION
- See Also:
-
LEVEL_OPTION
- See Also:
-
SKIP_INDEX
- See Also:
-
generatedFilesPath
-
comparator
-
skipIndex
private final boolean skipIndex
-
-
Constructor Details
-
TranslationFileGenerator
TranslationFileGenerator(ProcessingEnvironment processingEnv) The constructor.- Parameters:
processingEnv
- the processing env
-
-
Method Details
-
processTypeElement
public void processTypeElement(TypeElement annotation, TypeElement element, MessageInterface messageInterface) Description copied from class:AbstractGenerator
Processes a type element.- Specified by:
processTypeElement
in classAbstractGenerator
- Parameters:
annotation
- the annotation who trigger the processingelement
- the element that contains the methods.messageInterface
- the message interface to implement.
-
generateSkeletalTranslationFile
private void generateSkeletalTranslationFile(String relativePath, String fileName, MessageInterface messageInterface) Generate the translation file containing the given translations.- Parameters:
relativePath
- the relative pathfileName
- the file namemessageInterface
- the message interface
-
generateDefaultTranslationFile
Generates a default i18n properties file.- Parameters:
messageInterface
- the message interface
-
writeSkeletonMessageMethod
private void writeSkeletonMessageMethod(BufferedWriter writer, MessageMethod messageMethod) throws IOException - Throws:
IOException
-
parseParameterComments
- Throws:
IOException
-
isMethodWritable
-
writeSeparatorLine
- Throws:
IOException
-
getPrimaryClassNamePrefix
Returns the primary class simple name prefix for an element who represents a MessageBundle or MessageLogger interface.- Parameters:
element
- the element- Returns:
- the translation file name prefix
- Throws:
IllegalArgumentException
- if element is null or the element is not an interface
-
addIndexesToFormat
-