templates.enumsupport.enum_constant.vm Maven / Gradle / Ivy
The newest version!
#parse( "${include}/header.include.vm" )
#parse("${include}/generic.include.vm")
#set ( $typeClass = "${sourceinfo.baseClass.simpleName}")
#set ( $className ="${typeClass}Constant")
$codewriter.setCurrentJavaFilename("$pkg", "${className}.java")
#if(!$config.constantClasses.containsKey($sourceinfo.baseClass))##
#set($codewriter.saveCurrentFile = false)##
#stop##
#end##
#set ( $extendClasses = $config.constantClasses[$sourceinfo.baseClass])
#set($type = $sourceinfo)
#set($enumMetadata = ${sourceinfo.enumMetadata})
## 读取源码注释
## 默认#set语句不允许设置null,所以这里要通过#if判断来将$typeDoc设置为空
#if($JavadocReader.read(${type.baseClass}))
#set ($typeDoc = $JavadocReader.read(${type.baseClass}))
#set($typeDoc.indent = " ")
#else
#set ($typeDoc = "")
#end
package $pkg;
/**
$!{typeDoc.getClassComment(false,true,true)}##
* {@link #typeName(${sourceinfo.baseClass})}对应的支持类
* $GENERAED_BY
*
*/
#if($config.withAnnotation)
@com.gitee.l0km.codegen.annotations.EnumConstantType(${sourceinfo.baseClass.name}.class)
#end
public interface ${className} #if(!$extendClasses.empty)extends #join($extendClasses, "$e" ',') #end{
#foreach($en in ${type.enums})
#if(${enumMetadata.elementsDocumentation[$en]})
/** #join(${enumMetadata.elementsDocumentation[$en]} "$e" '') */
#end
public static final int ${en.name()} = #if($enumMetadata.byEnumConstant) ${enumMetadata.byEnumConstant[$en]}#else ${en.ordinal()} #end;
public static final String ${en.name()}_S = "${en.name()}";
#end
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy