本文整理了Java中com.sun.codemodel.JPackage.ref()
方法的一些代码示例,展示了JPackage.ref()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPackage.ref()
方法的具体详情如下:
包路径:com.sun.codemodel.JPackage
类名称:JPackage
方法名:ref
[英]Reference a class within this package.
[中]引用此包中的类。
代码示例来源:origin: org.glassfish.metro/webservices-tools
/**
* Gets the type of this property, if any.
* <p>
* {@code <element-ref>} particle doesn't have the type.
*
* @return
* null if none is specified.
*/
public final JClass getType() {
try {
String type = DOMUtil.getAttribute(element,"supertype");
if(type==null) return null;
// TODO: does this attribute defaults to the current package?
int idx = type.lastIndexOf('.');
if(idx<0) return parent.parent.codeModel.ref(type);
else return parent.parent.getTargetPackage().ref(type);
} catch( ClassNotFoundException e ) {
// TODO: better error handling
throw new NoClassDefFoundError(e.getMessage());
}
}
代码示例来源:origin: org.andromda.thirdparty.jaxb2_commons/jaxb-xjc
/**
* Gets the type of this property, if any.
* <p>
* <element-ref> particle doesn't have the type.
*
* @return
* null if none is specified.
*/
public final JClass getType() {
try {
String type = DOMUtil.getAttribute(element,"supertype");
if(type==null) return null;
// TODO: does this attribute defaults to the current package?
int idx = type.lastIndexOf('.');
if(idx<0) return parent.parent.codeModel.ref(type);
else return parent.parent.getTargetPackage().ref(type);
} catch( ClassNotFoundException e ) {
// TODO: better error handling
throw new NoClassDefFoundError(e.getMessage());
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-xjc
/**
* Gets the type of this property, if any.
* <p>
* {@code <element-ref>} particle doesn't have the type.
*
* @return
* null if none is specified.
*/
public final JClass getType() {
try {
String type = DOMUtil.getAttribute(element,"supertype");
if(type==null) return null;
// TODO: does this attribute defaults to the current package?
int idx = type.lastIndexOf('.');
if(idx<0) return parent.parent.codeModel.ref(type);
else return parent.parent.getTargetPackage().ref(type);
} catch( ClassNotFoundException e ) {
// TODO: better error handling
throw new NoClassDefFoundError(e.getMessage());
}
}
代码示例来源:origin: sun-jaxb/jaxb-xjc
/**
* Gets the type of this property, if any.
* <p>
* <element-ref> particle doesn't have the type.
*
* @return
* null if none is specified.
*/
public final JClass getType() {
try {
String type = DOMUtil.getAttribute(element,"supertype");
if(type==null) return null;
// TODO: does this attribute defaults to the current package?
int idx = type.lastIndexOf('.');
if(idx<0) return parent.parent.codeModel.ref(type);
else return parent.parent.getTargetPackage().ref(type);
} catch( ClassNotFoundException e ) {
// TODO: better error handling
throw new NoClassDefFoundError(e.getMessage());
}
}
代码示例来源:origin: apache/servicemix-bundles
/**
* Gets the type of this property, if any.
* <p>
* {@code <element-ref>} particle doesn't have the type.
*
* @return
* null if none is specified.
*/
public final JClass getType() {
try {
String type = DOMUtil.getAttribute(element,"supertype");
if(type==null) return null;
// TODO: does this attribute defaults to the current package?
int idx = type.lastIndexOf('.');
if(idx<0) return parent.parent.codeModel.ref(type);
else return parent.parent.getTargetPackage().ref(type);
} catch( ClassNotFoundException e ) {
// TODO: better error handling
throw new NoClassDefFoundError(e.getMessage());
}
}
内容来源于网络,如有侵权,请联系作者删除!