com.sun.codemodel.JPackage.ref()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(93)

本文整理了Java中com.sun.codemodel.JPackage.ref()方法的一些代码示例,展示了JPackage.ref()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPackage.ref()方法的具体详情如下:
包路径:com.sun.codemodel.JPackage
类名称:JPackage
方法名:ref

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>
 * &lt;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>
 * &lt;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());
  }
}

相关文章