All Downloads are FREE. Search and download functionalities are using the official Maven repository.

template.TestTemplate.vsl Maven / Gradle / Ivy

There is a newer version: 2.10.50
Show newest version
## Velocity Template.
package ${functionPackage};
#foreach( $import in $imports)
import $import;
#end

/**
 * generated wrapper for a test function.
 *  
 *
    *
  • output class : {@link Boolean} *
  • input class : {@link ${filterSubjectClass}} #foreach($sourceInfo in $sourceMappingList) *
  • input class : {@link ${sourceInfo.type}} #end *
  • map function : {@link ${targetClass}#${targetMethod}} *
  • multiArg : ${multiArgFunc} *
* * @author Greg Higgins */ public class ${functionClass} extends AbstractFilterWrapper{ public ${sourceClass} filterSubject; #if(${multiArgFunc}) private boolean filterSubjectUpdated; #end #foreach($sourceInfo in $sourceMappingList) public ${sourceInfo.type} ${sourceInfo.id}; #if(!${sourceInfo.constant}) private boolean ${sourceInfo.id}Updated; #end #end #if(!${newFunction}) @NoEventReference public ${targetClass} f; #end //private ${outputClass} result; #if(${stateful}) @NoEventReference public Object resetNotifier; private boolean parentReset = false; #end @OnEvent public boolean onEvent(){ #if(${newFunction}) #if(${multiArgFunc}) if(allSourcesUpdated()){ result = ${targetClass}.${targetMethod}(${input}); } #else result = ${targetClass}.${targetMethod}(${input}); #end #else #if(${multiArgFunc}) if(allSourcesUpdated()){ result = f.${targetMethod}(${input}); } #else result = f.${targetMethod}(${input}); #end #foreach($functionInfo in $sourceFunctions) if(${functionInfo.sourceInfo.id}Updated){ result = f.${targetMethod}(${functionInfo.paramString}); } #end #end return passed(); } #if(!${newFunction} || ${multiArgFunc} ) #if(${multiArgFunc}) private boolean allSourcesUpdated(){ boolean updated = filterSubjectUpdated; #foreach($sourceInfo in $sourceMappingList) #if(!${sourceInfo.constant}) updated &= ${sourceInfo.id}Updated; #end #end return updated; } @OnParentUpdate("filterSubject") public void updated_filterSubject(${sourceClass} updated){ filterSubjectUpdated = true; } #end #foreach($sourceInfo in $sourceMappingList) #if(!${sourceInfo.constant}) @OnParentUpdate("${sourceInfo.id}") public void updated_${sourceInfo.id}(${sourceInfo.type} updated){ ${sourceInfo.id}Updated = true; } #end #end #end #if(${stateful}) @OnParentUpdate("resetNotifier") public void resetNotification(Object resetNotifier) { parentReset = true; if (isResetImmediate()) { result = false; f.reset(); parentReset = false; } } @AfterEvent public void resetAfterEvent() { if (parentReset | alwaysReset) { result = false; f.reset(); } parentReset = false; } @Override public FilterWrapper resetNotifier(Object resetNotifier) { this.resetNotifier = resetNotifier; return this; } #end @Override public Boolean event() { return passed(); } @Override public Class eventClass() { return Boolean.class; } @Initialise public void init(){ result = false; #if(${multiArgFunc}) filterSubjectUpdated = ${sourceConstant}; #end #foreach($sourceInfo in $sourceMappingList) ${sourceInfo.id}Updated = false; #end } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy