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

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

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

Loader.loadClass介绍

[英]If running under JDK 1.2 load the specified class using the Thread``contextClassLoader if that fails try Class.forname. Under JDK 1.1 only Class.forName is used.
[中]

代码示例

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

/**
 * Instantiate the context selector class designated by the user. The selector
 * must have a constructor taking a LoggerContext instance as an argument.
 * 
 * @param defaultLoggerContext
 * @param contextSelectorStr
 * @return an instance of the designated context selector class
 * @throws ClassNotFoundException
 * @throws SecurityException
 * @throws NoSuchMethodException
 * @throws IllegalArgumentException
 * @throws InstantiationException
 * @throws IllegalAccessException
 * @throws InvocationTargetException
 */
static ContextSelector dynamicalContextSelector(LoggerContext defaultLoggerContext, String contextSelectorStr) throws ClassNotFoundException,
        SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException,
        InvocationTargetException {
  Class<?> contextSelectorClass = Loader.loadClass(contextSelectorStr);
  Constructor cons = contextSelectorClass.getConstructor(new Class[] { LoggerContext.class });
  return (ContextSelector) cons.newInstance(defaultLoggerContext);
}

代码示例来源:origin: googleapis/google-cloud-java

private <T> T getEnhancer(String enhancerClassName) {
 try {
  Class<T> clz = (Class<T>) Loader.loadClass(enhancerClassName.trim());
  return clz.newInstance();
 } catch (Exception ex) {
  // If we cannot create the enhancer we fallback to null
 }
 return null;
}

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

/**
 * Instantiate the context selector class designated by the user. The selector
 * must have a constructor taking a LoggerContext instance as an argument.
 * 
 * @param defaultLoggerContext
 * @param contextSelectorStr
 * @return an instance of the designated context selector class
 * @throws ClassNotFoundException
 * @throws SecurityException
 * @throws NoSuchMethodException
 * @throws IllegalArgumentException
 * @throws InstantiationException
 * @throws IllegalAccessException
 * @throws InvocationTargetException
 */
static ContextSelector dynamicalContextSelector(
  LoggerContext defaultLoggerContext, String contextSelectorStr)
  throws ClassNotFoundException, SecurityException, NoSuchMethodException,
  IllegalArgumentException, InstantiationException, IllegalAccessException,
  InvocationTargetException {
 Class<?> contextSelectorClass = Loader.loadClass(contextSelectorStr);
 Constructor cons = contextSelectorClass
   .getConstructor(new Class[] { LoggerContext.class });
 return (ContextSelector) cons.newInstance(defaultLoggerContext);
}

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

componentClass = Loader.loadClass(className, context);
} else {

代码示例来源:origin: com.google.cloud/google-cloud-logging-logback

private <T> T getEnhancer(String enhancerClassName) {
 try {
  Class<T> clz = (Class<T>) Loader.loadClass(enhancerClassName.trim());
  return clz.newInstance();
 } catch (Exception ex) {
  // If we cannot create the enhancer we fallback to null
 }
 return null;
}

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

/**
 * Instantiate the context selector class designated by the user. The selector
 * must have a constructor taking a LoggerContext instance as an argument.
 * 
 * @param defaultLoggerContext
 * @param contextSelectorStr
 * @return an instance of the designated context selector class
 * @throws ClassNotFoundException
 * @throws SecurityException
 * @throws NoSuchMethodException
 * @throws IllegalArgumentException
 * @throws InstantiationException
 * @throws IllegalAccessException
 * @throws InvocationTargetException
 */
static ContextSelector dynamicalContextSelector(LoggerContext defaultLoggerContext, String contextSelectorStr) throws ClassNotFoundException,
        SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException,
        InvocationTargetException {
  Class<?> contextSelectorClass = Loader.loadClass(contextSelectorStr);
  Constructor cons = contextSelectorClass.getConstructor(new Class[] { LoggerContext.class });
  return (ContextSelector) cons.newInstance(defaultLoggerContext);
}

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

/**
 * Instantiate the context selector class designated by the user. The selector
 * must have a constructor taking a LoggerContext instance as an argument.
 * 
 * @param defaultLoggerContext
 * @param contextSelectorStr
 * @return an instance of the designated context selector class
 * @throws ClassNotFoundException
 * @throws SecurityException
 * @throws NoSuchMethodException
 * @throws IllegalArgumentException
 * @throws InstantiationException
 * @throws IllegalAccessException
 * @throws InvocationTargetException
 */
static ContextSelector dynamicalContextSelector(
  LoggerContext defaultLoggerContext, String contextSelectorStr)
  throws ClassNotFoundException, SecurityException, NoSuchMethodException,
  IllegalArgumentException, InstantiationException, IllegalAccessException,
  InvocationTargetException {
 Class<?> contextSelectorClass = Loader.loadClass(contextSelectorStr);
 Constructor cons = contextSelectorClass
   .getConstructor(new Class[] { LoggerContext.class });
 return (ContextSelector) cons.newInstance(defaultLoggerContext);
}

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

/**
 * Instantiate the context selector class designated by the user. The selector
 * must have a constructor taking a LoggerContext instance as an argument.
 * 
 * @param defaultLoggerContext
 * @param contextSelectorStr
 * @return an instance of the designated context selector class
 * @throws ClassNotFoundException
 * @throws SecurityException
 * @throws NoSuchMethodException
 * @throws IllegalArgumentException
 * @throws InstantiationException
 * @throws IllegalAccessException
 * @throws InvocationTargetException
 */
static ContextSelector dynamicalContextSelector(LoggerContext defaultLoggerContext, String contextSelectorStr) throws ClassNotFoundException,
        SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException,
        InvocationTargetException {
  Class<?> contextSelectorClass = Loader.loadClass(contextSelectorStr);
  Constructor cons = contextSelectorClass.getConstructor(new Class[] { LoggerContext.class });
  return (ContextSelector) cons.newInstance(defaultLoggerContext);
}

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

/**
 * Instantiate the context selector class designated by the user. The selector
 * must have a constructor taking a LoggerContext instance as an argument.
 * 
 * @param defaultLoggerContext
 * @param contextSelectorStr
 * @return an instance of the designated context selector class
 * @throws ClassNotFoundException
 * @throws SecurityException
 * @throws NoSuchMethodException
 * @throws IllegalArgumentException
 * @throws InstantiationException
 * @throws IllegalAccessException
 * @throws InvocationTargetException
 */
static ContextSelector dynamicalContextSelector(LoggerContext defaultLoggerContext, String contextSelectorStr) throws ClassNotFoundException,
        SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException,
        InvocationTargetException {
  Class<?> contextSelectorClass = Loader.loadClass(contextSelectorStr);
  Constructor cons = contextSelectorClass.getConstructor(new Class[] { LoggerContext.class });
  return (ContextSelector) cons.newInstance(defaultLoggerContext);
}

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

/**
 * Instantiate the context selector class designated by the user. The selector
 * must have a constructor taking a LoggerContext instance as an argument.
 * 
 * @param defaultLoggerContext
 * @param contextSelectorStr
 * @return an instance of the designated context selector class
 * @throws ClassNotFoundException
 * @throws SecurityException
 * @throws NoSuchMethodException
 * @throws IllegalArgumentException
 * @throws InstantiationException
 * @throws IllegalAccessException
 * @throws InvocationTargetException
 */
static ContextSelector dynamicalContextSelector(
  LoggerContext defaultLoggerContext, String contextSelectorStr)
  throws ClassNotFoundException, SecurityException, NoSuchMethodException,
  IllegalArgumentException, InstantiationException, IllegalAccessException,
  InvocationTargetException {
 Class<?> contextSelectorClass = Loader.loadClass(contextSelectorStr);
 Constructor cons = contextSelectorClass
   .getConstructor(new Class[] { LoggerContext.class });
 return (ContextSelector) cons.newInstance(defaultLoggerContext);
}

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

componentClass = Loader.loadClass(className, context);
} else {

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

componentClass = Loader.loadClass(className, context);
} else {

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

componentClass = Loader.loadClass(className, context);
} else {

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

componentClass = Loader.loadClass(className, context);
} else {

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

componentClass = Loader.loadClass(className, context);
} else {

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

componentClass = Loader.loadClass(className, context);
} else {

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

componentClass = Loader.loadClass(className, context);
} else {

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

componentClass = Loader.loadClass(className, context);
} else {

相关文章