本文整理了Java中com.sun.codemodel.JPackage._enum()
方法的一些代码示例,展示了JPackage._enum()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPackage._enum()
方法的具体详情如下:
包路径:com.sun.codemodel.JPackage
类名称:JPackage
方法名:_enum
[英]Add a public enum to this package
[中]将公共枚举添加到此包
代码示例来源:origin: org.jvnet.ws.wadl/wadl-core
JDefinedClass $enum;
try {
$enum = parentClass._package()._enum(makeClassName(param.getName()));
javaDoc.generateEnumDoc(param, $enum);
for (Option o: param.getOption()) {
代码示例来源:origin: org.jsmiparser/jsmiparser-codegen
public JDefinedClass build() {
JPackage _package = determinePackage();
if (module.getVariables().isEmpty()) {
// can't generate an enum without constants ...
return null;
}
try {
definedClass = _package._enum(module.getCodeId());
} catch (JClassAlreadyExistsException e) {
throw new RuntimeException(e.getExistingClass().fullName() + " is already defined in the code model.", e);
}
// TODO add a package-info.html, ideally with the complete, hyperlinked mib
addJavadocs();
addInterfaces();
addEnumConstants();
addFields();
addConstructor();
addGetters();
addToString();
return definedClass;
}
代码示例来源:origin: org.jsmiparser/jsmiparser-codegen
public JDefinedClass build() {
JPackage _package = determinePackage();
try {
definedClass = _package._enum(typeName);
} catch (JClassAlreadyExistsException e) {
throw new RuntimeException(e.getExistingClass().fullName() + " is already defined in the code model.", e);
}
addJavadocs();
addInterfaces();
addEnumConstants();
addFields();
addConstructor();
addNameGetter();
addValueGetter();
// TODO add static findValue method: use a case statement, the compiler should be able to convert that into a binary search
// alternative: use the holder pattern to lazily and thread-safely initialize (and perhaps expose, but read-only) a data structure
addToString();
return definedClass;
}
内容来源于网络,如有侵权,请联系作者删除!