com.sun.xml.bind.util.Which类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(239)

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

Which介绍

[英]Finds out where a class file is loaded from.
[中]找出类文件从何处加载。

代码示例

代码示例来源:origin: com.sun.xml.bind/jaxb-impl

@Override
public String toString() {
  StringBuilder buf = new StringBuilder(Which.which(getClass()) + " Build-Id: " + getBuildId());
  buf.append("\nClasses known to this context:\n");
  Set<String> names = new TreeSet<String>();  // sort them so that it's easy to read
  for (Class key : beanInfoMap.keySet())
    names.add(key.getName());
  for(String name: names)
    buf.append("  ").append(name).append('\n');
  return buf.toString();
}

代码示例来源:origin: com.sun.xml.bind/jaxb-impl

public static String which( Class clazz ) {
  return which( clazz.getName(), SecureLoader.getClassClassLoader(clazz));
}

代码示例来源:origin: com.sun.xml.bind/jaxb-impl

Messages.format(Messages.DOM_IMPL_DOESNT_SUPPORT_CREATELEMENTNS,
document.getClass().getName(),
Which.which(document.getClass())));

代码示例来源:origin: org.glassfish.jaxb/jaxb-runtime

@Override
public String toString() {
  StringBuilder buf = new StringBuilder(Which.which(getClass()) + " Build-Id: " + getBuildId());
  buf.append("\nClasses known to this context:\n");
  Set<String> names = new TreeSet<String>();  // sort them so that it's easy to read
  for (Class key : beanInfoMap.keySet())
    names.add(key.getName());
  for(String name: names)
    buf.append("  ").append(name).append('\n');
  return buf.toString();
}

代码示例来源:origin: org.glassfish.jaxb/jaxb-runtime

public static String which( Class clazz ) {
  return which( clazz.getName(), SecureLoader.getClassClassLoader(clazz));
}

代码示例来源:origin: org.glassfish.jaxb/jaxb-runtime

Messages.format(Messages.DOM_IMPL_DOESNT_SUPPORT_CREATELEMENTNS,
document.getClass().getName(),
Which.which(document.getClass())));

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-impl

@Override
public String toString() {
  StringBuilder buf = new StringBuilder(Which.which(getClass()) + " Build-Id: " + getBuildId());
  buf.append("\nClasses known to this context:\n");
  Set<String> names = new TreeSet<String>();  // sort them so that it's easy to read
  for (Class key : beanInfoMap.keySet())
    names.add(key.getName());
  for(String name: names)
    buf.append("  ").append(name).append('\n');
  return buf.toString();
}

代码示例来源:origin: org.glassfish.jaxb/jaxb-core

public static String which( Class clazz ) {
  return which( clazz.getName(), SecureLoader.getClassClassLoader(clazz));
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public String toString() {
  StringBuilder buf = new StringBuilder(Which.which(getClass()) + " Build-Id: " + getBuildId());
  buf.append("\nClasses known to this context:\n");
  Set<String> names = new TreeSet<String>();  // sort them so that it's easy to read
  for (Class key : beanInfoMap.keySet())
    names.add(key.getName());
  for(String name: names)
    buf.append("  ").append(name).append('\n');
  return buf.toString();
}

代码示例来源:origin: com.sun.xml.bind/jaxb-core

public static String which( Class clazz ) {
  return which( clazz.getName(), SecureLoader.getClassClassLoader(clazz));
}

代码示例来源:origin: org.mule.glassfish.jaxb/jaxb-core

public static String which( Class clazz ) {
  return which( clazz.getName(), SecureLoader.getClassClassLoader(clazz));
}

代码示例来源:origin: apache/servicemix-bundles

public static String which( Class clazz ) {
  return which( clazz.getName(), SecureLoader.getClassClassLoader(clazz));
}

代码示例来源:origin: org.andromda.thirdparty.jaxb2_commons/jaxb-xjc

/**
 * Computes the file system path of <tt>jaxb-api.jar</tt> so that
 * APT will see them in the <tt>-cp</tt> option.
 *
 * <p>
 * In Java, you can't do this reliably (for that matter there's no guarantee
 * that such a jar file exists, such as in Glassfish), so we do the best we can.
 *
 * @return
 *      null if failed to locate it.
 */
private static File findJaxbApiJar() {
  String url = Which.which(JAXBContext.class);
  if(url==null)       return null;    // impossible, but hey, let's be defensive
  if(!url.startsWith("jar:") || url.lastIndexOf('!')==-1)
    // no jar file
    return null;
  String jarFileUrl = url.substring(4,url.lastIndexOf('!'));
  if(!jarFileUrl.startsWith("file:"))
    return null;    // not from file system
  try {
    File f = new File(new URL(jarFileUrl).getFile());
    if(f.exists() && f.getName().endsWith(".jar"))
      return f;
    else
      return null;
  } catch (MalformedURLException e) {
    return null;    // impossible
  }
}

代码示例来源:origin: sun-jaxb/jaxb-xjc

/**
 * Computes the file system path of <tt>jaxb-api.jar</tt> so that
 * APT will see them in the <tt>-cp</tt> option.
 *
 * <p>
 * In Java, you can't do this reliably (for that matter there's no guarantee
 * that such a jar file exists, such as in Glassfish), so we do the best we can.
 *
 * @return
 *      null if failed to locate it.
 */
private static File findJaxbApiJar() {
  String url = Which.which(JAXBContext.class);
  if(url==null)       return null;    // impossible, but hey, let's be defensive
  if(!url.startsWith("jar:") || url.lastIndexOf('!')==-1)
    // no jar file
    return null;
  String jarFileUrl = url.substring(4,url.lastIndexOf('!'));
  if(!jarFileUrl.startsWith("file:"))
    return null;    // not from file system
  try {
    File f = new File(new URL(jarFileUrl).getFile());
    if(f.exists() && f.getName().endsWith(".jar"))
      return f;
    else
      return null;
  } catch (MalformedURLException e) {
    return null;    // impossible
  }
}

代码示例来源:origin: com.sun.xml.bind/jaxb-jxc

String url = Which.which(JAXBContext.class);
if(url==null)       return null;    // impossible, but hey, let's be defensive

代码示例来源:origin: org.glassfish.metro/webservices-tools

String url = Which.which(JAXBContext.class);
if(url==null)       return null;    // impossible, but hey, let's be defensive

代码示例来源:origin: com.sun.xml.ws/rt

public MessageFactory getMessageFactory() {
  try {
    return SAAJFactory.getMessageFactory(saajFactoryString); 
  } catch (SOAPException e) {
    throw new Error(e);
  } catch (NoSuchMethodError e) {
    // SAAJ 1.3 is not in the classpath
    LinkageError x = new LinkageError("You are loading old SAAJ from "+ Which.which(MessageFactory.class));
    x.initCause(e);
    throw x;
  }
}

代码示例来源:origin: javaee/metro-jax-ws

public MessageFactory getMessageFactory() {
  try {
    return SAAJFactory.getMessageFactory(saajFactoryString); 
  } catch (SOAPException e) {
    throw new Error(e);
  } catch (NoSuchMethodError e) {
    // SAAJ 1.3 is not in the classpath
    LinkageError x = new LinkageError("You are loading old SAAJ from "+ Which.which(MessageFactory.class));
    x.initCause(e);
    throw x;
  }
}

代码示例来源:origin: com.sun.xml.ws/jaxws-rt

public SOAPFactory getSOAPFactory() {
  try {
    return SAAJFactory.getSOAPFactory(saajFactoryString);
  } catch (SOAPException e) {
    throw new Error(e);
  } catch (NoSuchMethodError e) {
    // SAAJ 1.3 is not in the classpath
    LinkageError x = new LinkageError("You are loading old SAAJ from "+ Which.which(MessageFactory.class));
    x.initCause(e);
    throw x;
  }
}

代码示例来源:origin: com.sun.xml.ws/jaxws-rt

public MessageFactory getMessageFactory() {
  try {
    return SAAJFactory.getMessageFactory(saajFactoryString); 
  } catch (SOAPException e) {
    throw new Error(e);
  } catch (NoSuchMethodError e) {
    // SAAJ 1.3 is not in the classpath
    LinkageError x = new LinkageError("You are loading old SAAJ from "+ Which.which(MessageFactory.class));
    x.initCause(e);
    throw x;
  }
}

相关文章