@@ -0,0 +1,2191 @@
+package org.codemucker.jmutate.generate.log;%0A%0Aimport org.apache.commons.configuration.Configuration;%0Aimport org.apache.log4j.LogManager;%0Aimport org.apache.log4j.Logger;%0Aimport org.codemucker.jmutate.JMutateContext;%0Aimport org.codemucker.jmutate.SourceTemplate;%0Aimport org.codemucker.jmutate.ast.JType;%0Aimport org.codemucker.jmutate.generate.AbstractGenerator;%0Aimport org.codemucker.jmutate.generate.GenerateOptions;%0Aimport org.codemucker.jmutate.generate.SmartConfig;%0Aimport org.codemucker.jpattern.generate.ClashStrategy;%0Aimport org.codemucker.jpattern.generate.GenerateLog;%0A%0Aimport com.google.common.base.Strings;%0Aimport com.google.inject.Inject;%0A%0A/**%0A * Generates the 'LOG' field%0A */%0Apublic class LogGenerator extends AbstractGenerator%3CGenerateLog%3E %7B%0A%0A%09private static final Logger LOG = LogManager.getLogger(LogGenerator.class);%0A%0A%09@Inject%0A%09public LogGenerator(JMutateContext ctxt) %7B%0A%09%09super(ctxt);%0A%09%7D%0A%09%0A%09protected void generate(JType type, SmartConfig config) %7B%0A%09%09%0A%09%09LogOptions options = config.mapFromTo(GenerateLog.class, LogOptions.class);%0A%09%09%0A%09%09if(options.isEnabled() && !type.isInterface() && !type.isEnum())%7B%0A%09%09%09String fieldName = options.fieldName;%0A%09%09%09if(Strings.isNullOrEmpty(fieldName))%7B%0A%09%09%09%09fieldName = %22LOG%22;%0A%09%09%09%7D%0A%09%09%09%0A%09%09%09LOG.debug(%22adding field '%22 + fieldName + %22'%22);%0A%0A%09%09%09String topic;%0A%09%09%09if(Strings.isNullOrEmpty(options.topic))%7B%0A%09%09%09%09topic = type.getSimpleName() + %22.class%22 + (options.logger.isTakesClass()?%22%22:%22.getName()%22);%0A%09%09%09%7D else %7B%0A%09%09%09%09topic = '%22' + options.topic + '%22';%0A%09%09%09%7D%0A%09%09%09SourceTemplate logField = newSourceTemplate()%0A%09%09%09%09.var(%22field.name%22, fieldName)%0A%09%09%09%09.var(%22topic%22, topic)%0A%09%09%09%09.var(%22logger.type%22, options.logger.getLoggerType())%0A%09%09%09%09.var(%22logger.manager%22, options.logger.getLogManagerExpression())%0A%09%09%09%09%0A%09%09%09%09%0A%09%09%09%09.pl(%22private static final $%7Blogger.type%7D $%7Bfield.name%7D = $%7Blogger.manager%7D($%7Btopic%7D);%22);%0A%09%09%09%0A%09%09%09addField(type, logField.asFieldNodeSnippet(),options.isMarkGenerated());%0A%09%09%09%0A%09%09%09writeToDiskIfChanged(type.getCompilationUnit().getSource());%0A%09%09%7D%0A%09%7D%0A%0A%09public static class LogOptions extends GenerateOptions%3CGenerateLog%3E %7B%0A%0A%09%09public String fieldName;%0A%09%09public String topic;%0A%09%09public GenerateLog.Type logger;%0A%09%09public ClashStrategy clashStrategy;%0A%09%09%0A%09%09%0A%09%7D%0A%7D

add a generator for GenerateLogger