template.ConsoleLoggerTemplate.vsl Maven / Gradle / Ivy
## Velocity Template.
package ${functionPackage};
#foreach( $import in $imports)
import $import;
#end
/**
* Generated notificationToLogger.
*
* @author Greg Higgins
*/
public class ${functionClass} extends MsgBuilder{
//source operand inputs
#foreach($sourceInfo in $sourceMappingList)
#if(${updateNotifier})
@NoEventReference
#end
public ${sourceInfo.type} ${sourceInfo.id};
#end
#if(${updateNotifier})
public Object logNotifier;
private boolean notificationToLog;
@OnParentUpdate(value = "logNotifier")
public void postLog(Object logNotifier){
notificationToLog = true;
}
@OnEvent
public boolean buildMessage() {
if(notificationToLog & isGoodToLog()){
#foreach($valueAccessor in $valueAccessorList)
msgSink.append("${valueAccessor.message}");
msgSink.append(${valueAccessor.value});
#end
msgSink.append("${lastMessage}");
msgSink.append('\n');
notificationToLog = false;
return true;
}
notificationToLog = false;
return false;
}
#else
@OnEvent
public boolean buildMessage() {
if(!isGoodToLog())
return false;
#foreach($valueAccessor in $valueAccessorList)
msgSink.append("${valueAccessor.message}");
msgSink.append(${valueAccessor.value});
#end
msgSink.append("${lastMessage}");
msgSink.append('\n');
return true;
}
#end
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy