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.LevelComparatorprivate static final Stringprivate static final Stringprivate static final String(package private) static final String(package private) static final Stringprivate final Stringprivate static final String(package private) static final Stringprivate static final Pattern(package private) static final Stringprivate final booleanFields inherited from class org.jboss.logging.processor.apt.AbstractGenerator
processingEnv -
Constructor Summary
ConstructorsConstructorDescriptionTranslationFileGenerator(ProcessingEnvironment processingEnv) The constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate StringaddIndexesToFormat(MessageMethod method) private voidgenerateDefaultTranslationFile(MessageInterface messageInterface) Generates a default i18n properties file.private voidgenerateSkeletalTranslationFile(String relativePath, String fileName, MessageInterface messageInterface) Generate the translation file containing the given translations.private static StringgetPrimaryClassNamePrefix(TypeElement element) Returns the primary class simple name prefix for an element who represents a MessageBundle or MessageLogger interface.private booleanisMethodWritable(MessageMethod method) parseParameterComments(MessageMethod messageMethod) voidprocessTypeElement(TypeElement annotation, TypeElement element, MessageInterface messageInterface) Processes a type element.private static voidwriteSeparatorLine(BufferedWriter writer) private voidwriteSkeletonMessageMethod(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:AbstractGeneratorProcesses a type element.- Specified by:
processTypeElementin 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
-