Dynamically create a {@link ILoggingTool} for the given
<code>sourceClass</code>.

@param  sourceClass Class for which the {@link ILoggingTool} should be
constructed.
@return             An {@link ILoggingTool} implementation.
184701
public static ILoggingTool createLoggingTool(Class<?> sourceClass) {
        ILoggingTool tool = null;
        // first attempt the user set ILoggingTool
        if (userSetILoggerTool != null) {
            tool = instantiateWithCreateMethod(sourceClass, userSetILoggerTool);
        }
        if (tool == null) {
            tool = initializeLoggingTool(sourceClass, DEFAULT_LOGGING_TOOL_CLASS);
        }
        if (tool == null) {
            tool = initializeLoggingTool(sourceClass, STDOUT_LOGGING_TOOL_CLASS);
        }
        return tool;
    }
1068937
public Trace getTrace(Class sourceClass,
                          String traceGroup) {
        synchronized (activeTrace) {
            TraceImpl traceImpl = new TraceImpl(sourceClass, traceGroup, this);
            activeTrace.put(sourceClass, traceImpl);
            try {
                applyActiveTrace();
            } catch (java.io.IOException exception) {
                System.out.println(cclass + ":getTrace() exception" + exception);
                exception.printStackTrace();
            } // try.

            return traceImpl;
        } // synchronized (activeTrace).
    }
655457
protected Class<?> loadSourceClass( final String name ) {
        final String fileName = '/' + name.replace('.', '/') + ".java";
        final URL url = getResource( fileName );
        if ( url == null )
            return null;
        try (FileReader reader
                = new FileReader((InputStream) url.getContent())) {
            Interpreter.debug("Loading class from source file: " + fileName);
            declaringInterpreter.eval( reader );
        } catch ( IOException | EvalError e ) {
            if (Interpreter.DEBUG.get())
                e.printStackTrace();
        }
        try {
            return plainClassForName( name );
        } catch ( final ClassNotFoundException e ) {
            Interpreter.debug("Class not found in source file: " + name);
            return null;
        }
    }
1281469
public static <E> JpaRepositoryConfig.Builder<E> builder(Class<E> entityClass) {
        JpaRepositoryConfig.Builder<E> builder = new JpaRepositoryConfig.Builder<>();
        builder.entityClass = entityClass;
        builder.resourceClass = entityClass;
        return builder;
    }
593761
@Override
    public IApimanLogger createLogger(Class <?> klazz) {
        delegatedLogger = LogManager.getLogger(klazz);
        this.klazz = klazz;
        return this;
    }
21641
@Nonnull
  public static <T> UBLPEReaderBuilder <T> create (@Nonnull final Class <T> aClass)
  {
    return new UBLPEReaderBuilder <> (aClass);
  }
830461
@Override
    public  <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
        return AnnotationUtils.getAnnotation(target, annotationClass);
    }
1041245
@Nonnull
  public static <T> UBL22ReaderBuilder <T> create (@Nonnull final Class <T> aClass)
  {
    return new UBL22ReaderBuilder<> (aClass);
  }
209182
@SuppressWarnings("unchecked")
    public static <T> T createProxyObject(Class<T> proxyClass) {
        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(proxyClass);
        enhancer.setCallback(new InvokeInterceptor(proxyClass));
        return (T) enhancer.create();
    }
617149
@Nonnull
  public static <T> UBLTRReaderBuilder <T> create (@Nonnull final Class <T> aClass)
  {
    return new UBLTRReaderBuilder <> (aClass);
  }
31594
public static SourceLineAnnotation forEntireMethod(JavaClass javaClass, XMethod xmethod) {
        JavaClassAndMethod m = Hierarchy.findMethod(javaClass, xmethod.getName(), xmethod.getSignature());
        if (m == null) {
            return createUnknown(javaClass.getClassName(), javaClass.getSourceFileName());
        } else {
            return forEntireMethod(javaClass, m.getMethod());
        }
    }
934578
public static boolean hasAnnotation(final ClassNode classNode, final Class<? extends Annotation> annotationClass) {
        return !classNode.getAnnotations(new ClassNode(annotationClass)).isEmpty();
    }
218041
public ClassSource create(final String source) {
    checkNotNull(source);

    String trimmed = source.trim();
    log.trace("Creating class-source from: {}", trimmed);

    // First try and parse the source as a URL
    try {
      return new ClassSourceImpl(new URL(trimmed), null, null);
    }
    catch (MalformedURLException e) {
      log.trace("Not a URL", e);
    }

    // FIXME: This is _slightly_ problematic as if you have a valid file ref
    // FIXME: but the file is missing then it will be treated as inline instead of as a file

    // Then as a File
    try {
      File file = new File(trimmed).getCanonicalFile();
      if (file.exists()) {
        return new ClassSourceImpl(null, file, null);
      }
    }
    catch (IOException e) {
      log.trace("Not a File", e);
    }

    // Else it is an inline
    return new ClassSourceImpl(null, null, new InlineImpl(source));
  }
1054849
@Nonnull
  public static <T> UBL20ValidatorBuilder <T> create (@Nonnull final Class <T> aClass)
  {
    return new UBL20ValidatorBuilder <> (aClass);
  }
405101
private void generateClass(TreeLogger logger, GeneratorContext context) throws Throwable {

        // get print writer that receives the source code
        PrintWriter printWriter = context.tryCreate(logger, packageName, className);

        // print writer if null, source code has ALREADY been generated, return
        if (printWriter == null) { return; }

        // init composer, set class properties, create source writer
        ClassSourceFileComposerFactory composerFactory =
                new ClassSourceFileComposerFactory(packageName, className);

        // Imports
        composerFactory.addImport("org.jboss.as.console.client.Console");
        composerFactory.addImport("org.jboss.as.console.client.ProductConfig");

        composerFactory.addImport("java.util.*");

        // Interfaces
        composerFactory.addImplementedInterface("org.jboss.as.console.client.ProductConfig");

        // SourceWriter
        SourceWriter sourceWriter = composerFactory.createSourceWriter(context, printWriter);

        // ctor
        generateConstructor(sourceWriter);

        // Methods
        generateMethods(logger, sourceWriter, context);

        // close generated class
        sourceWriter.outdent();
        sourceWriter.println("}");

        // commit generated class
        context.commit(logger, printWriter);
    }
332784
@Nullable
    public static <T extends Annotation> T extract(Class<?> targetClass, Class<T> annotationClass) {
        T annotation = null;
        if (targetClass.isAnnotationPresent(annotationClass)) {
            annotation = targetClass.getAnnotation(annotationClass);
            if (annotation == null && logger.isDebugEnabled()) {
                logger.debug("TargetClass has no annotation '{}'", annotationClass.getSimpleName());
                annotation = targetClass.getDeclaredAnnotation(annotationClass);
                if (annotation == null && logger.isDebugEnabled()) {
                    logger.debug("TargetClass has no declared annotation '{}'", annotationClass.getSimpleName());
                }
            }
        }
        return annotation;
    }
399806
public TemporaryFileBuilder fromClasspathResource(final String pathToResource) {
        final Class<?> callerClass = getCallerClass();
        this.content = getResolver().resolve(pathToResource, callerClass);
        return this;
    }