ch.qos.logback.core.util.Loader.getClassLoaderOfClass()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(221)

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

Loader.getClassLoaderOfClass介绍

[英]Return the class loader which loaded the class passed as argument. Return the system class loader if appropriate.
[中]返回加载作为参数传递的类的类加载器。如果合适,返回系统类加载器。

代码示例

代码示例来源:origin: ch.qos.logback/logback-classic

  1. private static ClassLoader getServiceLoaderClassLoader() {
  2. return testServiceLoaderClassLoader == null ? Loader.getClassLoaderOfClass(EnvUtil.class) : testServiceLoaderClassLoader;
  3. }

代码示例来源:origin: ch.qos.logback/logback-classic

  1. static public boolean isGroovyAvailable() {
  2. ClassLoader classLoader = Loader.getClassLoaderOfClass(EnvUtil.class);
  3. try {
  4. Class<?> bindingClass = classLoader.loadClass("groovy.lang.Binding");
  5. return (bindingClass != null);
  6. } catch (ClassNotFoundException e) {
  7. return false;
  8. }
  9. }

代码示例来源:origin: camunda/camunda-bpm-platform

  1. static public boolean isGroovyAvailable() {
  2. ClassLoader classLoader = Loader.getClassLoaderOfClass(EnvUtil.class);
  3. try {
  4. Class bindingClass = classLoader.loadClass("groovy.lang.Binding");
  5. return (bindingClass != null);
  6. } catch (ClassNotFoundException e) {
  7. return false;
  8. }
  9. }

代码示例来源:origin: camunda/camunda-bpm-platform

  1. /**
  2. * Get the class loader of the object passed as argument. Return the system
  3. * class loader if appropriate.
  4. *
  5. * @param o
  6. * @return
  7. */
  8. public static ClassLoader getClassLoaderOfObject(Object o) {
  9. if (o == null) {
  10. throw new NullPointerException("Argument cannot be null");
  11. }
  12. return getClassLoaderOfClass(o.getClass());
  13. }

代码示例来源:origin: camunda/camunda-bpm-platform

  1. /**
  2. * Attempt to find a resource by using the classloader that loaded this class,
  3. * namely Loader.class.
  4. *
  5. * @param resource
  6. * @return
  7. */
  8. public static URL getResourceBySelfClassLoader(String resource) {
  9. return getResource(resource, getClassLoaderOfClass(Loader.class));
  10. }

代码示例来源:origin: Nextdoor/bender

  1. static public boolean isGroovyAvailable() {
  2. ClassLoader classLoader = Loader.getClassLoaderOfClass(EnvUtil.class);
  3. try {
  4. Class<?> bindingClass = classLoader.loadClass("groovy.lang.Binding");
  5. return (bindingClass != null);
  6. } catch (ClassNotFoundException e) {
  7. return false;
  8. }
  9. }

代码示例来源:origin: io.virtdata/virtdata-lib-realer

  1. static public boolean isGroovyAvailable() {
  2. ClassLoader classLoader = Loader.getClassLoaderOfClass(EnvUtil.class);
  3. try {
  4. Class<?> bindingClass = classLoader.loadClass("groovy.lang.Binding");
  5. return (bindingClass != null);
  6. } catch (ClassNotFoundException e) {
  7. return false;
  8. }
  9. }

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

  1. static public boolean isGroovyAvailable() {
  2. ClassLoader classLoader = Loader.getClassLoaderOfClass(EnvUtil.class);
  3. try {
  4. Class<?> bindingClass = classLoader.loadClass("groovy.lang.Binding");
  5. return (bindingClass != null);
  6. } catch (ClassNotFoundException e) {
  7. return false;
  8. }
  9. }

代码示例来源:origin: tony19/logback-android

  1. /**
  2. * Get the class loader of the object passed as argument. Return the system
  3. * class loader if appropriate.
  4. *
  5. * @param o object to evaluate
  6. * @return the classloader of the object
  7. */
  8. public static ClassLoader getClassLoaderOfObject(Object o) {
  9. if (o == null) {
  10. throw new NullPointerException("Argument cannot be null");
  11. }
  12. return getClassLoaderOfClass(o.getClass());
  13. }

代码示例来源:origin: com.hynnet/logback-core

  1. /**
  2. * Get the class loader of the object passed as argument. Return the system
  3. * class loader if appropriate.
  4. *
  5. * @param o
  6. * @return
  7. */
  8. public static ClassLoader getClassLoaderOfObject(Object o) {
  9. if (o == null) {
  10. throw new NullPointerException("Argument cannot be null");
  11. }
  12. return getClassLoaderOfClass(o.getClass());
  13. }

代码示例来源:origin: ch.qos.logback/core

  1. /**
  2. * Get the class loader of the object passed as argument. Return the system
  3. * class loader if appropriate.
  4. *
  5. * @param o
  6. * @return
  7. */
  8. public static ClassLoader getClassLoaderOfObject(Object o) {
  9. if (o == null) {
  10. throw new NullPointerException("Argument cannot be null");
  11. }
  12. return getClassLoaderOfClass(o.getClass());
  13. }

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

  1. /**
  2. * Get the class loader of the object passed as argument. Return the system
  3. * class loader if appropriate.
  4. *
  5. * @param o
  6. * @return
  7. */
  8. public static ClassLoader getClassLoaderOfObject(Object o) {
  9. if (o == null) {
  10. throw new NullPointerException("Argument cannot be null");
  11. }
  12. return getClassLoaderOfClass(o.getClass());
  13. }

代码示例来源:origin: io.virtdata/virtdata-lib-realer

  1. /**
  2. * Attempt to find a resource by using the classloader that loaded this class,
  3. * namely Loader.class.
  4. *
  5. * @param resource
  6. * @return
  7. */
  8. public static URL getResourceBySelfClassLoader(String resource) {
  9. return getResource(resource, getClassLoaderOfClass(Loader.class));
  10. }

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

  1. /**
  2. * Attempt to find a resource by using the classloader that loaded this class,
  3. * namely Loader.class.
  4. *
  5. * @param resource
  6. * @return
  7. */
  8. public static URL getResourceBySelfClassLoader(String resource) {
  9. return getResource(resource, getClassLoaderOfClass(Loader.class));
  10. }

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/ch.qos.logback.core

  1. /**
  2. * Attempt to find a resource by using the classloader that loaded this class,
  3. * namely Loader.class.
  4. *
  5. * @param resource
  6. * @return
  7. */
  8. public static URL getResourceBySelfClassLoader(String resource) {
  9. return getResource(resource, getClassLoaderOfClass(Loader.class));
  10. }

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

  1. /**
  2. * Attempt to find a resource by using the classloader that loaded this class,
  3. * namely Loader.class.
  4. *
  5. * @param resource
  6. * @return
  7. */
  8. public static URL getResourceBySelfClassLoader(String resource) {
  9. return getResource(resource, getClassLoaderOfClass(Loader.class));
  10. }

代码示例来源:origin: tony19/logback-android

  1. /**
  2. * Attempt to find a resource by using the classloader that loaded this class,
  3. * namely Loader.class.
  4. *
  5. * @param resource the resource name to look for
  6. * @return resource URL
  7. */
  8. public static URL getResourceBySelfClassLoader(String resource) {
  9. return getResource(resource, getClassLoaderOfClass(Loader.class));
  10. }

代码示例来源:origin: com.hynnet/logback-core

  1. /**
  2. * Attempt to find a resource by using the classloader that loaded this class,
  3. * namely Loader.class.
  4. *
  5. * @param resource
  6. * @return
  7. */
  8. public static URL getResourceBySelfClassLoader(String resource) {
  9. return getResource(resource, getClassLoaderOfClass(Loader.class));
  10. }

代码示例来源:origin: ch.qos.logback/core

  1. /**
  2. * Attempt to find a resource by using the classloader that loaded this class,
  3. * namely Loader.class.
  4. *
  5. * @param resource
  6. * @return
  7. */
  8. public static URL getResourceBySelfClassLoader(String resource) {
  9. return getResource(resource, getClassLoaderOfClass(Loader.class));
  10. }

代码示例来源:origin: Nextdoor/bender

  1. /**
  2. * Attempt to find a resource by using the classloader that loaded this class,
  3. * namely Loader.class.
  4. *
  5. * @param resource
  6. * @return
  7. */
  8. public static URL getResourceBySelfClassLoader(String resource) {
  9. return getResource(resource, getClassLoaderOfClass(Loader.class));
  10. }

相关文章