Tabnine Logo
Reflection
Code IndexAdd Tabnine to your IDE (free)

How to use
Reflection
in
cascading.lingual.util

Best Java code snippets using cascading.lingual.util.Reflection (Showing top 13 results out of 315)

origin: cascading/lingual-core

public static <T> T invokeInstanceMethodSafe( Object target, String methodName, Object parameter, Class parameterType )
 {
 try
  {
  return invokeInstanceMethod( target, methodName, new Object[]{parameter}, new Class[]{parameterType} );
  }
 catch( Exception exception )
  {
  return null;
  }
 }
origin: cascading/lingual-core

public static Object invokeStaticMethod( ClassLoader loader, String typeString, String methodName, Object[] parameters, Class[] parameterTypes )
 {
 Class type = loadClass( loader, typeString );
 return invokeStaticMethod( type, methodName, parameters, parameterTypes );
 }
origin: cascading/lingual-core

public static Object newInstanceSafe( Class type )
 {
 if( type == null )
  return null;
 try
  {
  return newInstance( type );
  }
 catch( Exception exception )
  {
  return null;
  }
 }
origin: cascading/lingual-core

public static void setLogLevel( ClassLoader loader, String log, String level )
 {
 Object loggerObject = getLoggerObject( loader, log );
 Object levelObject = Reflection.invokeStaticMethod( loader, "org.apache.log4j.Level", "toLevel",
  new Object[]{level}, new Class[]{String.class} );
 Reflection.invokeInstanceMethod( loggerObject, "setLevel", levelObject, levelObject.getClass() );
 }
origin: cascading/lingual-platform

public TestProviderFactory()
 {
 String [] classNames = { "cascading.lingual.platform.local.LocalDefaultFactory",
              "cascading.lingual.platform.hadoop.HadoopDefaultFactory",
              "cascading.lingual.platform.hadoop2.Hadoop2MR1DefaultFactory",
              "cascading.lingual.platform.tez.TezDefaultFactory" };
 for( String className: classNames)
  {
  factory = (DefaultFactory) newInstanceSafe( loadClassSafe( className ) );
  if( factory != null )
   break;
  }
 if( factory == null )
  throw new IllegalStateException( "unable to load factory from known classes" );
 }
origin: cascading/lingual-core

private CatalogService loadCatalogServicePlugin()
 {
 // getServiceUtil is a private method, this allows for an impl to be loaded from an internal classloader
 ServiceLoader loader = Reflection.invokeInstanceMethod( getCascadingServices(), "getServiceUtil" );
 Properties defaultProperties = Reflection.getStaticField( getCascadingServices().getClass(), "defaultProperties" );
 return (CatalogService) loader.loadServiceFrom( defaultProperties, getProperties(), CatalogService.CATALOG_SERVICE_CLASS_PROPERTY );
 }
origin: cascading/lingual-core

public static Class<?> loadClassSafe( String typeString )
 {
 try
  {
  return loadClass( typeString );
  }
 catch( Exception exception )
  {
  return null;
  }
 }
origin: cascading/lingual-core

private static Object getLoggerObject( ClassLoader loader, String log )
 {
 if( log == null || log.isEmpty() )
  return Reflection.invokeStaticMethod( loader, "org.apache.log4j.Logger", "getRootLogger", null, null );
 return Reflection.invokeStaticMethod( loader, "org.apache.log4j.Logger", "getLogger",
  new Object[]{log}, new Class[]{String.class} );
 }
}
origin: cascading/lingual-core

public static Class<?> loadClass( ClassLoader loader, String typeString )
 {
 try
  {
  return loader.loadClass( typeString );
  }
 catch( ClassNotFoundException exception )
  {
  throw new CascadingException( "unable to load class: " + typeString, exception );
  }
 }
origin: cascading/lingual-core

public static <T> T invokeInstanceMethod( Object target, String methodName )
 {
 return invokeInstanceMethod( target, methodName, (Object[]) null, (Class[]) null );
 }
origin: cascading/lingual-core

private Class loadClass( String className, String jarPath )
 {
 LOG.debug( "loading: {} from: {}", className, jarPath );
 if( jarPath == null ) // its a default factory
  {
  classLoader = Thread.currentThread().getContextClassLoader();
  return Reflection.loadClass( classLoader, className );
  }
 String qualifiedPath = platformBroker.makePath( platformBroker.getFullProviderPath(), jarPath );
 try
  {
  return platformBroker.loadClass( qualifiedPath, className );
  }
 finally
  {
  try
   {
   classLoader = platformBroker.getUrlClassLoader( qualifiedPath );
   }
  catch( Exception exception )
   {
   // do nothing
   }
  }
 }
}
origin: cascading/lingual-core

public static <T> T invokeInstanceMethod( Object target, String methodName, Object parameter, Class parameterType )
 {
 return invokeInstanceMethod( target, methodName, new Object[]{parameter}, new Class[]{parameterType} );
 }
origin: cascading/lingual-core

public static String getLogLevel( ClassLoader loader, String log )
 {
 Object loggerObject = getLoggerObject( loader, log );
 Object level = Reflection.invokeInstanceMethod( loggerObject, "getLevel" );
 if( level == null )
  return "";
 return level.toString();
 }
cascading.lingual.utilReflection

Javadoc

Reflection is a reflection utility helper.

Most used methods

  • getStaticField
  • invokeInstanceMethod
  • invokeStaticMethod
  • loadClass
  • loadClassSafe
  • newInstance
  • newInstanceSafe

Popular in Java

  • Making http requests using okhttp
  • getSharedPreferences (Context)
  • getContentResolver (Context)
  • getApplicationContext (Context)
  • Kernel (java.awt.image)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Top plugins for Android Studio
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