下面列出了怎么用 com.sun.codemodel.internal.ClassType 的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* Generates the minimum {@link JDefinedClass} skeleton
* without filling in its body.
*/
private EnumOutline generateEnumDef(CEnumLeafInfo e) {
JDefinedClass type;
type = getClassFactory().createClass(
getContainer(e.parent, EXPOSED), e.shortName, e.getLocator(), ClassType.ENUM);
type.javadoc().append(e.javadoc);
return new EnumOutline(e, type) {
@Override
public
@NotNull
Outline parent() {
return BeanGenerator.this;
}
};
}
/** Gets the xjc:superInterface customization if it's turned on. */
public JClass getSuperInterface() {
Element sc = DOMUtil.getElement(dom,XJC_NS,"superInterface");
if (sc == null) return null;
String name = DOMUtil.getAttribute(sc,"name");
if (name == null) return null;
JDefinedClass c;
try {
c = codeModel._class(name, ClassType.INTERFACE);
c.hide();
} catch (JClassAlreadyExistsException e) {
c = e.getExistingClass();
}
return c;
}
/** Gets the xjc:superInterface customization if it's turned on. */
public JClass getSuperInterface() {
Element sc = DOMUtil.getElement(dom,XJC_NS,"superInterface");
if (sc == null) return null;
String name = DOMUtil.getAttribute(sc,"name");
if (name == null) return null;
JDefinedClass c;
try {
c = codeModel._class(name, ClassType.INTERFACE);
c.hide();
} catch (JClassAlreadyExistsException e) {
c = e.getExistingClass();
}
return c;
}
/**
* Generates the minimum {@link JDefinedClass} skeleton
* without filling in its body.
*/
private EnumOutline generateEnumDef(CEnumLeafInfo e) {
JDefinedClass type;
type = getClassFactory().createClass(
getContainer(e.parent, EXPOSED), e.shortName, e.getLocator(), ClassType.ENUM);
type.javadoc().append(e.javadoc);
return new EnumOutline(e, type) {
@Override
public
@NotNull
Outline parent() {
return BeanGenerator.this;
}
};
}
/**
* Generates the minimum {@link JDefinedClass} skeleton
* without filling in its body.
*/
private EnumOutline generateEnumDef(CEnumLeafInfo e) {
JDefinedClass type;
type = getClassFactory().createClass(
getContainer(e.parent, EXPOSED), e.shortName, e.getLocator(), ClassType.ENUM);
type.javadoc().append(e.javadoc);
return new EnumOutline(e, type) {
@Override
public
@NotNull
Outline parent() {
return BeanGenerator.this;
}
};
}
/** Gets the xjc:superInterface customization if it's turned on. */
public JClass getSuperInterface() {
Element sc = DOMUtil.getElement(dom,XJC_NS,"superInterface");
if (sc == null) return null;
String name = DOMUtil.getAttribute(sc,"name");
if (name == null) return null;
JDefinedClass c;
try {
c = codeModel._class(name, ClassType.INTERFACE);
c.hide();
} catch (JClassAlreadyExistsException e) {
c = e.getExistingClass();
}
return c;
}
/**
* Generates the minimum {@link JDefinedClass} skeleton
* without filling in its body.
*/
private EnumOutline generateEnumDef(CEnumLeafInfo e) {
JDefinedClass type;
type = getClassFactory().createClass(
getContainer(e.parent, EXPOSED), e.shortName, e.getLocator(), ClassType.ENUM);
type.javadoc().append(e.javadoc);
return new EnumOutline(e, type) {
@Override
public
@NotNull
Outline parent() {
return BeanGenerator.this;
}
};
}
/** Gets the xjc:superInterface customization if it's turned on. */
public JClass getSuperInterface() {
Element sc = DOMUtil.getElement(dom,XJC_NS,"superInterface");
if (sc == null) return null;
String name = DOMUtil.getAttribute(sc,"name");
if (name == null) return null;
JDefinedClass c;
try {
c = codeModel._class(name, ClassType.INTERFACE);
c.hide();
} catch (JClassAlreadyExistsException e) {
c = e.getExistingClass();
}
return c;
}
/**
* Generates the minimum {@link JDefinedClass} skeleton
* without filling in its body.
*/
private EnumOutline generateEnumDef(CEnumLeafInfo e) {
JDefinedClass type;
type = getClassFactory().createClass(
getContainer(e.parent, EXPOSED), e.shortName, e.getLocator(), ClassType.ENUM);
type.javadoc().append(e.javadoc);
return new EnumOutline(e, type) {
@Override
public
@NotNull
Outline parent() {
return BeanGenerator.this;
}
};
}
/** Gets the xjc:superInterface customization if it's turned on. */
public JClass getSuperInterface() {
Element sc = DOMUtil.getElement(dom,XJC_NS,"superInterface");
if (sc == null) return null;
String name = DOMUtil.getAttribute(sc,"name");
if (name == null) return null;
JDefinedClass c;
try {
c = codeModel._class(name, ClassType.INTERFACE);
c.hide();
} catch (JClassAlreadyExistsException e) {
c = e.getExistingClass();
}
return c;
}
/**
* Generates the minimum {@link JDefinedClass} skeleton
* without filling in its body.
*/
private EnumOutline generateEnumDef(CEnumLeafInfo e) {
JDefinedClass type;
type = getClassFactory().createClass(
getContainer(e.parent, EXPOSED), e.shortName, e.getLocator(), ClassType.ENUM);
type.javadoc().append(e.javadoc);
return new EnumOutline(e, type) {
@Override
public
@NotNull
Outline parent() {
return BeanGenerator.this;
}
};
}
/** Gets the xjc:superInterface customization if it's turned on. */
public JClass getSuperInterface() {
Element sc = DOMUtil.getElement(dom,XJC_NS,"superInterface");
if (sc == null) return null;
String name = DOMUtil.getAttribute(sc,"name");
if (name == null) return null;
JDefinedClass c;
try {
c = codeModel._class(name, ClassType.INTERFACE);
c.hide();
} catch (JClassAlreadyExistsException e) {
c = e.getExistingClass();
}
return c;
}
/**
* Generates the minimum {@link JDefinedClass} skeleton
* without filling in its body.
*/
private EnumOutline generateEnumDef(CEnumLeafInfo e) {
JDefinedClass type;
type = getClassFactory().createClass(
getContainer(e.parent, EXPOSED), e.shortName, e.getLocator(), ClassType.ENUM);
type.javadoc().append(e.javadoc);
return new EnumOutline(e, type) {
@Override
public
@NotNull
Outline parent() {
return BeanGenerator.this;
}
};
}
/** Gets the xjc:superInterface customization if it's turned on. */
public JClass getSuperInterface() {
Element sc = DOMUtil.getElement(dom,XJC_NS,"superInterface");
if (sc == null) return null;
String name = DOMUtil.getAttribute(sc,"name");
if (name == null) return null;
JDefinedClass c;
try {
c = codeModel._class(name, ClassType.INTERFACE);
c.hide();
} catch (JClassAlreadyExistsException e) {
c = e.getExistingClass();
}
return c;
}
/**
* Generates the minimum {@link JDefinedClass} skeleton
* without filling in its body.
*/
private EnumOutline generateEnumDef(CEnumLeafInfo e) {
JDefinedClass type;
type = getClassFactory().createClass(
getContainer(e.parent, EXPOSED), e.shortName, e.getLocator(), ClassType.ENUM);
type.javadoc().append(e.javadoc);
return new EnumOutline(e, type) {
@Override
public
@NotNull
Outline parent() {
return BeanGenerator.this;
}
};
}
protected JDefinedClass getClass(String className, ClassType type) throws JClassAlreadyExistsException {
JDefinedClass cls;
try {
cls = cm._class(className, type);
} catch (JClassAlreadyExistsException e){
cls = cm._getClass(className);
if (cls == null) {
throw e;
}
}
return cls;
}
JDefinedClass getClazz(ClassType t) {
if (clazz != null) return clazz;
try {
JCodeModel codeModel = Ring.get(JCodeModel.class);
clazz = codeModel._class(name, t);
clazz.hide();
return clazz;
} catch (JClassAlreadyExistsException e) {
return e.getExistingClass();
}
}
JDefinedClass getClazz(ClassType t) {
if (clazz != null) return clazz;
try {
JCodeModel codeModel = Ring.get(JCodeModel.class);
clazz = codeModel._class(name, t);
clazz.hide();
return clazz;
} catch (JClassAlreadyExistsException e) {
return e.getExistingClass();
}
}
protected JDefinedClass getClass(String className, ClassType type) throws JClassAlreadyExistsException {
JDefinedClass cls;
try {
cls = cm._class(className, type);
} catch (JClassAlreadyExistsException e){
cls = cm._getClass(className);
if (cls == null) {
throw e;
}
}
return cls;
}
JDefinedClass getClazz(ClassType t) {
if (clazz != null) return clazz;
try {
JCodeModel codeModel = Ring.get(JCodeModel.class);
clazz = codeModel._class(name, t);
clazz.hide();
return clazz;
} catch (JClassAlreadyExistsException e) {
return e.getExistingClass();
}
}
protected JDefinedClass getClass(String className, ClassType type) throws JClassAlreadyExistsException {
JDefinedClass cls;
try {
cls = cm._class(className, type);
} catch (JClassAlreadyExistsException e){
cls = cm._getClass(className);
if (cls == null) {
throw e;
}
}
return cls;
}
JDefinedClass getClazz(ClassType t) {
if (clazz != null) return clazz;
try {
JCodeModel codeModel = Ring.get(JCodeModel.class);
clazz = codeModel._class(name, t);
clazz.hide();
return clazz;
} catch (JClassAlreadyExistsException e) {
return e.getExistingClass();
}
}
protected JDefinedClass getClass(String className, ClassType type) throws JClassAlreadyExistsException {
JDefinedClass cls;
try {
cls = cm._class(className, type);
} catch (JClassAlreadyExistsException e){
cls = cm._getClass(className);
if (cls == null) {
throw e;
}
}
return cls;
}
JDefinedClass getClazz(ClassType t) {
if (clazz != null) return clazz;
try {
JCodeModel codeModel = Ring.get(JCodeModel.class);
clazz = codeModel._class(name, t);
clazz.hide();
return clazz;
} catch (JClassAlreadyExistsException e) {
return e.getExistingClass();
}
}
JDefinedClass getClazz(ClassType t) {
if (clazz != null) return clazz;
try {
JCodeModel codeModel = Ring.get(JCodeModel.class);
clazz = codeModel._class(name, t);
clazz.hide();
return clazz;
} catch (JClassAlreadyExistsException e) {
return e.getExistingClass();
}
}
protected JDefinedClass getClass(String className, ClassType type) throws JClassAlreadyExistsException {
JDefinedClass cls;
try {
cls = cm._class(className, type);
} catch (JClassAlreadyExistsException e){
cls = cm._getClass(className);
if (cls == null) {
throw e;
}
}
return cls;
}
protected JDefinedClass getClass(String className, ClassType type) throws JClassAlreadyExistsException {
JDefinedClass cls;
try {
cls = cm._class(className, type);
} catch (JClassAlreadyExistsException e){
cls = cm._getClass(className);
if (cls == null) {
throw e;
}
}
return cls;
}
JDefinedClass getClazz(ClassType t) {
if (clazz != null) return clazz;
try {
JCodeModel codeModel = Ring.get(JCodeModel.class);
clazz = codeModel._class(name, t);
clazz.hide();
return clazz;
} catch (JClassAlreadyExistsException e) {
return e.getExistingClass();
}
}
protected JDefinedClass getClass(String className, ClassType type) throws JClassAlreadyExistsException {
JDefinedClass cls;
try {
cls = cm._class(className, type);
} catch (JClassAlreadyExistsException e){
cls = cm._getClass(className);
if (cls == null) {
throw e;
}
}
return cls;
}
JDefinedClass getClazz(ClassType t) {
if (clazz != null) return clazz;
try {
JCodeModel codeModel = Ring.get(JCodeModel.class);
clazz = codeModel._class(name, t);
clazz.hide();
return clazz;
} catch (JClassAlreadyExistsException e) {
return e.getExistingClass();
}
}