serp.bytecode.BCClass.getInterfaceNames()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(104)

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

BCClass.getInterfaceNames介绍

[英]Return the names of all unique interfaces implemented by this class, including those of all superclasses. The names will be returned in a form suitable for a Class#forName call. This method does not recurse into interfaces-of-interfaces.
[中]返回该类实现的所有唯一接口的名称,包括所有超类的名称。名称将以适合类#forName调用的形式返回。此方法不会递归到接口的接口中。

代码示例

代码示例来源:origin: org.apache.openejb.patch/openjpa-kernel

public static void main(String[] args)
  throws IOException {
  Project project = new Project();
  
  InputStream in = WASManagedRuntime.class.getClassLoader()
    .getResourceAsStream(CLASS.replace('.', '/') + ".class");
  BCClass bcClass = project.loadClass(in);
  
  String [] interfaces = bcClass.getInterfaceNames();
  
  if(interfaces != null) {
    for(int i = 0; i < interfaces.length; i++) { 
      if(interfaces[i].equals(INTERFACE)) {
        return; 
      }
    }
  }
  bcClass.declareInterface(INTERFACE);
  AsmAdaptor.write(bcClass);
}

代码示例来源:origin: org.apache.openejb.patch/openjpa

public static void main(String[] args)
  throws IOException {
  Project project = new Project();
  
  InputStream in = WASManagedRuntime.class.getClassLoader()
    .getResourceAsStream(CLASS.replace('.', '/') + ".class");
  BCClass bcClass = project.loadClass(in);
  
  String [] interfaces = bcClass.getInterfaceNames();
  
  if(interfaces != null) {
    for(int i = 0; i < interfaces.length; i++) { 
      if(interfaces[i].equals(INTERFACE)) {
        return; 
      }
    }
  }
  bcClass.declareInterface(INTERFACE);
  AsmAdaptor.write(bcClass);
}

代码示例来源:origin: org.apache.openjpa/com.springsource.org.apache.openjpa

public static void main(String[] args)
  throws IOException {
  Project project = new Project();
  
  InputStream in = WASManagedRuntime.class.getClassLoader()
    .getResourceAsStream(CLASS.replace('.', '/') + ".class");
  BCClass bcClass = project.loadClass(in);
  
  String [] interfaces = bcClass.getInterfaceNames();
  
  if(interfaces != null) {
    for(int i = 0; i < interfaces.length; i++) { 
      if(interfaces[i].equals(INTERFACE)) {
        return; 
      }
    }
  }
  bcClass.declareInterface(INTERFACE);
  bcClass.write();
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

public static void main(String[] args)
  throws IOException {
  Project project = new Project();
  
  InputStream in = WASManagedRuntime.class.getClassLoader()
    .getResourceAsStream(CLASS.replace('.', '/') + ".class");
  BCClass bcClass = project.loadClass(in);
  
  String [] interfaces = bcClass.getInterfaceNames();
  
  if(interfaces != null) {
    for(int i = 0; i < interfaces.length; i++) { 
      if(interfaces[i].equals(INTERFACE)) {
        return; 
      }
    }
  }
  bcClass.declareInterface(INTERFACE);
  AsmAdaptor.write(bcClass);
}

代码示例来源:origin: org.apache.openjpa/openjpa-kernel

public static void main(String[] args)
  throws IOException {
  Project project = new Project();
  
  InputStream in = WASManagedRuntime.class.getClassLoader()
    .getResourceAsStream(CLASS.replace('.', '/') + ".class");
  BCClass bcClass = project.loadClass(in);
  
  String [] interfaces = bcClass.getInterfaceNames();
  
  if(interfaces != null) {
    for(int i = 0; i < interfaces.length; i++) { 
      if(interfaces[i].equals(INTERFACE)) {
        return; 
      }
    }
  }
  bcClass.declareInterface(INTERFACE);
  AsmAdaptor.write(bcClass);
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

/**
 * Return true if this class or any of its superclasses implement/extend
 * the given interface/class.
 * This method does not recurse into interfaces-of-interfaces.
 */
public boolean isInstanceOf(String name) {
  name = _project.getNameCache().getExternalForm(name, false);
  String[] interfaces = getInterfaceNames();
  for (int i = 0; i < interfaces.length; i++)
    if (interfaces[i].equals(name))
      return true;
  for (BCClass type = this; type != null; type = type.getSuperclassBC())
    if (type.getName().equals(name))
      return true;
  return false;
}

代码示例来源:origin: net.sourceforge.serp/serp

/**
 * Return true if this class or any of its superclasses implement/extend
 * the given interface/class.
 * This method does not recurse into interfaces-of-interfaces.
 */
public boolean isInstanceOf(String name) {
  name = _project.getNameCache().getExternalForm(name, false);
  String[] interfaces = getInterfaceNames();
  for (int i = 0; i < interfaces.length; i++)
    if (interfaces[i].equals(name))
      return true;
  for (BCClass type = this; type != null; type = type.getSuperclassBC())
    if (type.getName().equals(name))
      return true;
  return false;
}

相关文章

微信公众号

最新文章

更多