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

codegen.templates.Command Maven / Gradle / Ivy

There is a newer version: 0.6
Show newest version
<@pp.dropOutputFile /> 
<#list commandDefs as def> 
<#global cmd=def.command>
<#global commandName=def.commandName>
<#global optionName=cmd.simpleName+"Option">
<#global optionsName=cmd.simpleName+"Options">
<#global factoryName=cmd.simpleName+"Factory">
<#global optionSetsName=cmd.simpleName+"OptionSets">
<@pp.changeOutputFile name=pp.pathTo("/"+cmd.pkg.path+"/"+cmd.simpleName+".java")/> 
package ${cmd.pkg.name};

import org.unix4j.command.CommandInterface;

import ${def.pkg.name}.${factoryName};
<#if def.options?size != 0>
import ${def.pkg.name}.${optionName};
import ${def.pkg.name}.${optionsName};
import ${def.pkg.name}.${optionSetsName};


<#function isOptionsArg def arg>
	<#return def.operands[arg].type == optionsName>

<#macro synopsisArg def arg><#if 
	isOptionsArg(def, arg)>[-<#foreach opt in def.options?values>${opt.acronym}]<#else
	><${arg}>
/**
 * Non-instantiable module with inner types making up the ${commandName} command.
 * 

* NAME *

* ${def.name} *

* SYNOPSIS *

*

<#foreach method in def.methods> * *
{@code ${method.name}<#foreach arg in method.args> <@synopsisArg def arg/>}
*

* See {@link Interface} for the corresponding command signature methods. *

* DESCRIPTION *

* ${def.description} * <#if def.notes?size != 0> *

* NOTES *

*

    <#foreach note in def.notes> *
  • ${note}
  • *
* *

* Options *

<#if def.options?size != 0> * The following options are supported: *

<#include "/include/options-javadoc.java"> <#else> * The command supports no options. *

* OPERANDS *

* The following operands are supported: *

*

<#foreach opd in def.operands?values> * *
{@code <${opd.name}>} : {@code ${opd.type}} ${opd.desc}
*/ public final class ${cmd.simpleName} { /** * The "${commandName}" command name. */ public static final String NAME = "${commandName}"; /** * Interface defining all method signatures for the "${commandName}" command. * <#include "/include/returntype-class-javadoc.java"> */ public static interface Interface extends CommandInterface { <#foreach method in def.methods> /** * ${method.desc} * <#foreach arg in method.args> * @param ${arg} ${def.operands[arg].desc} <#include "/include/returntype-method-javadoc.java"> */ R ${method.name}(<#foreach arg in method.args>${def.operands[arg].type} ${arg}<#if arg_has_next>, ); } <#if def.options?size != 0> /** * Options for the "${commandName}" command: <#foreach opt in def.options?values>{@link ${optionName}#${opt.name} ${opt.acronym}}<#if opt_has_next>, . *

<#include "/include/options-javadoc.java"> */ public static final ${optionSetsName} Options = ${optionSetsName}.INSTANCE; /** * Singleton {@link ${factoryName} factory} instance for the "${commandName}" command. */ public static final ${factoryName} Factory = ${factoryName}.INSTANCE; // no instances private ${cmd.simpleName}() { super(); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy