public class PropertiesAsConstantsGenerator extends ClassGenerator
- (generate key/values to property file (from bean-attribute informations))
- load key/values from property file.
- map them into a Map[Integer, Object] where the integers are the hashes of the keys.
- generate an interface for that property file with:
public static final Integer [key-as-constant-name]=[hash(key)];
These constants can then be used to get the mapped values:
myresourceBundle.getString([generated-interface].[key-name-as-constant-name]);
DEFAULT_DEST_POSTFIX, DEFAULT_DEST_PREFIX, DEST_FILENAME_PATTERN, DEST_POSTFIX, DEST_PREFIX, LOG, POSTFIX_CLS, SRC_NAME| Constructor and Description |
|---|
PropertiesAsConstantsGenerator() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
getDefaultDestinationFile(String modelFile)
override this method to provide a default destination file
|
protected Object |
getModel(String modelFile,
ClassLoader classLoader)
override this method to provide your class model (the source class)
|
static void |
main(String[] args) |
generate, generate, getDefaultClassloader, getDestinationClassName, getDestinationPackageName, getUtilityInstance, init, instance, instance, instanceprotected Object getModel(String modelFile, ClassLoader classLoader)
getModel in class ClassGeneratormodelFile - source file name (normally a beans java file name)classLoader - classloader to be used to load modelFile class.protected String getDefaultDestinationFile(String modelFile)
getDefaultDestinationFile in class ClassGeneratormodelFile - source fileClassGenerator.getModel(String, ClassLoader)public static final void main(String[] args)
Copyright © 2012–2018. All rights reserved.