congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ObjectUtilities.getClassLoader
Code IndexAdd Tabnine to your IDE (free)

How to use
getClassLoader
method
in
org.jfree.util.ObjectUtilities

Best Java code snippets using org.jfree.util.ObjectUtilities.getClassLoader (Showing top 20 results out of 315)

origin: jfree/jcommon

/**
 * Returns the resource specified by the <strong>absolute</strong> name.
 *
 * @param name the name of the resource
 * @param c    the source class
 * @return the url of the resource or null, if not found.
 */
public static URL getResource(final String name, final Class c) {
  final ClassLoader cl = getClassLoader(c);
  if (cl == null) {
    return null;
  }
  return cl.getResource(name);
}
origin: org.jfree/com.springsource.org.jfree

/**
 * Returns the resource specified by the <strong>absolute</strong> name.
 *
 * @param name the name of the resource
 * @param c    the source class
 * @return the url of the resource or null, if not found.
 */
public static URL getResource(final String name, final Class c) {
  final ClassLoader cl = getClassLoader(c);
  if (cl == null) {
    return null;
  }
  return cl.getResource(name);
}
origin: org.jfree/jcommon

/**
 * Returns the resource specified by the <strong>absolute</strong> name.
 *
 * @param name the name of the resource
 * @param c    the source class
 * @return the url of the resource or null, if not found.
 */
public static URL getResource(final String name, final Class c) {
  final ClassLoader cl = getClassLoader(c);
  if (cl == null) {
    return null;
  }
  return cl.getResource(name);
}
origin: org.jfree/jcommon

/**
 * Tries to load a class to indirectly check for the existence
 * of a certain library.
 *
 * @param name the name of the library class.
 * @param context the context class to get a classloader from.
 * @return true, if the class could be loaded, false otherwise.
 */
protected static boolean isClassLoadable(final String name, final Class context)
{
 try
 {
  ObjectUtilities.getClassLoader(context).loadClass(name);
  return true;
 }
 catch (Exception e)
 {
  return false;
 }
}
origin: jfree/jcommon

/**
 * Tries to load a class to indirectly check for the existence
 * of a certain library.
 *
 * @param name the name of the library class.
 * @param context the context class to get a classloader from.
 * @return true, if the class could be loaded, false otherwise.
 */
protected static boolean isClassLoadable(final String name, final Class context)
{
 try
 {
  ObjectUtilities.getClassLoader(context).loadClass(name);
  return true;
 }
 catch (Exception e)
 {
  return false;
 }
}
origin: org.jfree/com.springsource.org.jfree

/**
 * Tries to load a class to indirectly check for the existence
 * of a certain library.
 *
 * @param name the name of the library class.
 * @param context the context class to get a classloader from.
 * @return true, if the class could be loaded, false otherwise.
 */
protected static boolean isClassLoadable(final String name, final Class context)
{
 try
 {
  ObjectUtilities.getClassLoader(context).loadClass(name);
  return true;
 }
 catch (Exception e)
 {
  return false;
 }
}
origin: jfree/jcommon

/**
 * Tries to create a new instance of the given class. This is a short cut
 * for the common bean instantiation code.
 *
 * @param className the class name as String, never null.
 * @param source    the source class, from where to get the classloader.
 * @return the instantiated object or null, if an error occured.
 */
public static Object loadAndInstantiate(final String className,
                    final Class source) {
  try {
    final ClassLoader loader = getClassLoader(source);
    final Class c = loader.loadClass(className);
    return c.newInstance();
  }
  catch (Exception e) {
    return null;
  }
}
origin: org.jfree/com.springsource.org.jfree

/**
 * Tries to create a new instance of the given class. This is a short cut
 * for the common bean instantiation code.
 *
 * @param className the class name as String, never null.
 * @param source    the source class, from where to get the classloader.
 * @return the instantiated object or null, if an error occured.
 */
public static Object loadAndInstantiate(final String className,
                    final Class source) {
  try {
    final ClassLoader loader = getClassLoader(source);
    final Class c = loader.loadClass(className);
    return c.newInstance();
  }
  catch (Exception e) {
    return null;
  }
}
origin: org.jfree/jcommon

/**
 * Tries to create a new instance of the given class. This is a short cut
 * for the common bean instantiation code.
 *
 * @param className the class name as String, never null.
 * @param source    the source class, from where to get the classloader.
 * @return the instantiated object or null, if an error occured.
 */
public static Object loadAndInstantiate(final String className,
                    final Class source) {
  try {
    final ClassLoader loader = getClassLoader(source);
    final Class c = loader.loadClass(className);
    return c.newInstance();
  }
  catch (Exception e) {
    return null;
  }
}
origin: jfree/jcommon

/**
 * Creates an object based on this object description.
 *
 * @return The object.
 */
public Object createObject() {
  try {
    final String o = (String) getParameter("class");
    return ObjectUtilities.getClassLoader(getClass()).loadClass(o).newInstance();
  }
  catch (Exception e) {
    return null;
  }
}
origin: org.jfree/com.springsource.org.jfree

protected Library loadLibrary(final String classname) {
  if (classname == null) {
    return null;
  }
  try {
    final Class c = ObjectUtilities.getClassLoader(
        getClass()).loadClass(classname);
    try {
      final Method m = c.getMethod("getInstance", (Class[]) null);
      return (Library) m.invoke(null, (Object[]) null);
    }
    catch(Exception e) {
      // ok, fall back ...
    }
    return (Library) c.newInstance();
  }
  catch (Exception e) {
    // ok, this library has no 'getInstance()' method. Check the
    // default constructor ...
    return null;
  }
}
origin: jfree/jcommon

/**
 * Returns the resource specified by the <strong>relative</strong> name.
 *
 * @param name the name of the resource relative to the given class
 * @param c    the source class
 * @return the url of the resource or null, if not found.
 */
public static URL getResourceRelative(final String name, final Class c) {
  final ClassLoader cl = getClassLoader(c);
  final String cname = convertName(name, c);
  if (cl == null) {
    return null;
  }
  return cl.getResource(cname);
}
origin: org.jfree/jcommon

/**
 * Returns the resource specified by the <strong>relative</strong> name.
 *
 * @param name the name of the resource relative to the given class
 * @param c    the source class
 * @return the url of the resource or null, if not found.
 */
public static URL getResourceRelative(final String name, final Class c) {
  final ClassLoader cl = getClassLoader(c);
  final String cname = convertName(name, c);
  if (cl == null) {
    return null;
  }
  return cl.getResource(cname);
}
origin: org.jfree/com.springsource.org.jfree

/**
 * Returns the resource specified by the <strong>relative</strong> name.
 *
 * @param name the name of the resource relative to the given class
 * @param c    the source class
 * @return the url of the resource or null, if not found.
 */
public static URL getResourceRelative(final String name, final Class c) {
  final ClassLoader cl = getClassLoader(c);
  final String cname = convertName(name, c);
  if (cl == null) {
    return null;
  }
  return cl.getResource(cname);
}
origin: jfree/jcommon

/**
 * Loads the specified booter implementation.
 *
 * @param classname  the class name.
 *
 * @return The boot class.
 */
protected AbstractBoot loadBooter(final String classname) {
  if (classname == null) {
    return null;
  }
  try {
    final Class c = ObjectUtilities.getClassLoader(
        getClass()).loadClass(classname);
    final Method m = c.getMethod("getInstance", (Class[]) null);
    return (AbstractBoot) m.invoke(null, (Object[]) null);
  }
  catch (Exception e) {
    Log.info ("Unable to boot dependent class: " + classname);
    return null;
  }
}
origin: org.jfree/jcommon

/**
 * Loads the specified booter implementation.
 *
 * @param classname  the class name.
 *
 * @return The boot class.
 */
protected AbstractBoot loadBooter(final String classname) {
  if (classname == null) {
    return null;
  }
  try {
    final Class c = ObjectUtilities.getClassLoader(
        getClass()).loadClass(classname);
    final Method m = c.getMethod("getInstance", (Class[]) null);
    return (AbstractBoot) m.invoke(null, (Object[]) null);
  }
  catch (Exception e) {
    Log.info ("Unable to boot dependent class: " + classname);
    return null;
  }
}
origin: org.jfree/com.springsource.org.jfree

/**
 * Loads the specified booter implementation.
 *
 * @param classname  the class name.
 *
 * @return The boot class.
 */
protected AbstractBoot loadBooter(final String classname) {
  if (classname == null) {
    return null;
  }
  try {
    final Class c = ObjectUtilities.getClassLoader(
        getClass()).loadClass(classname);
    final Method m = c.getMethod("getInstance", (Class[]) null);
    return (AbstractBoot) m.invoke(null, (Object[]) null);
  }
  catch (Exception e) {
    Log.info ("Unable to boot dependent class: " + classname);
    return null;
  }
}
origin: jfree/jcommon

/**
 * Loads a class by its fully qualified name.
 * 
 * @param name  the class name.
 * 
 * @return The class (or <code>null</code> if there was a problem loading the class).
 */
protected Class loadClass(final String name) {
  try {
    return ObjectUtilities.getClassLoader(JavaSourceCollector.class).loadClass(name);
  }
  catch (Exception e) {
    Log.warn (new Log.SimpleMessage("Do not process: Failed to load class:", name));
    return null;
  }
}
origin: jfree/jcommon

/**
 * Loads the given class, and ignores all exceptions which may occur
 * during the loading. If the class was invalid, null is returned instead.
 *
 * @param className the name of the class to be loaded.
 * @return the class or null.
 * 
 * @throws XMLWriterException if there is a writer exception.
 */
protected XmlWriteHandler loadHandlerClass(final String className)
  throws XMLWriterException {
  if (className == null) {
    throw new XMLWriterException("LoadHanderClass: Class name not defined");
  }
  try {
    final Class c = ObjectUtilities.getClassLoader(getClass()).loadClass(className);
    return (XmlWriteHandler) c.newInstance();
  }
  catch (Exception e) {
    // ignore buggy classes for now ..
    throw new XMLWriterException("LoadHanderClass: Unable to instantiate " + className, e);
  }
}
 
origin: jfree/jcommon

/**
 * Loads the given class, and ignores all exceptions which may occur
 * during the loading. If the class was invalid, null is returned instead.
 *
 * @param className the name of the class to be loaded.
 * @return the class or null.
 * @throws XmlReaderException if there is a reader error.
 */
protected Class loadClass(final String className)
  throws XmlReaderException {
  if (className == null) {
    throw new XmlReaderException("LoadHanderClass: Class name not defined");
  }
  try {
    final Class c = ObjectUtilities.getClassLoader(getClass()).loadClass(className);
    return c;
  }
  catch (Exception e) {
    // ignore buggy classes for now ..
    throw new XmlReaderException("LoadHanderClass: Unable to load " + className, e);
  }
}
org.jfree.utilObjectUtilitiesgetClassLoader

Javadoc

Returns the custom classloader or null, if no custom classloader is defined.

Popular methods of ObjectUtilities

  • equal
    Returns true if the two objects are equal OR bothnull.
  • clone
    Returns a clone of the specified object, if it can be cloned, otherwise throws a CloneNotSupportedEx
  • convertName
    Transform the class-relative resource name into a global name by appending it to the classes package
  • getClassLoaderSource
    Returns the internal configuration entry, whether the classloader of the thread context or the conte
  • getResource
    Returns the resource specified by the absolute name.
  • getResourceRelative
    Returns the resource specified by the relative name.
  • getResourceRelativeAsStream
    Returns the inputstream for the resource specified by therelative name.
  • loadAndInstantiate
    Tries to create a new instance of the given class. This is a short cut for the common bean instantia
  • parseVersions
  • setClassLoaderSource
    Defines the internal configuration entry, whether the classloader of the thread context or the conte
  • deepClone
    Returns a new collection containing clones of all the items in the specified collection.
  • hashCode
    Returns a hash code for an object, or zero if the object isnull.
  • deepClone,
  • hashCode

Popular in Java

  • Making http post requests using okhttp
  • onRequestPermissionsResult (Fragment)
  • setContentView (Activity)
  • putExtra (Intent)
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now