private static Class<?> initClass(String type) { try { return TypeUtil.forName(type); } catch (Throwable t) { // No Java 8 } return null; }
public static <T> T newInstance(String type, Class<T> cast) throws ClassNotFoundException, InstantiationException, IllegalAccessException { return forName(type, cast).newInstance(); }
public static <T> T newInstance(String type, Class<T> cast) throws ClassNotFoundException, InstantiationException, IllegalAccessException { return forName(type, cast).newInstance(); }
private static Class<?> forName(String name, String instantiator) { if (name.length() == 0) return HashMap.class; String className = (instantiator != null ? instantiator : name); try { return TypeUtil.forName(className); } catch (Throwable t) { throw new RuntimeException("Class not found: " + className); } }
private static Class<?> forName(String name, String instantiator) { if (name.length() == 0) return HashMap.class; String className = (instantiator != null ? instantiator : name); try { return TypeUtil.forName(className); } catch (Throwable t) { throw new RuntimeException("Class not found: " + className); } }
private static Class<?> forName(String name, String instantiator) { if (name.length() == 0) return HashMap.class; String className = (instantiator != null ? instantiator : name); try { return TypeUtil.forName(className); } catch (Throwable t) { throw new RuntimeException("Class not found: " + className); } }
public SunConstructorFactory() { try { Class<?> factoryClass = TypeUtil.forName("sun.reflect.ReflectionFactory"); Method getReflectionFactory = factoryClass.getDeclaredMethod("getReflectionFactory"); reflectionFactory = getReflectionFactory.invoke(null); newConstructorForSerialization = factoryClass.getDeclaredMethod( "newConstructorForSerialization", new Class[]{Class.class, Constructor.class} ); } catch (Exception e) { throw new RuntimeException("Could not create Sun Factory", e); } }
public Class<? extends ActionScriptClassDescriptor> getInstance(String type, GraniteConfig config) throws GraniteConfigException { try { return TypeUtil.forName(type, ActionScriptClassDescriptor.class); } catch (Exception e) { throw new GraniteConfigException("Could not load ActionScriptClassDescriptor type: " + type, e); } }
public TideComponentInstanceOfMatcher(String type, boolean disabled) { try { parentClass = TypeUtil.forName(type); this.disabled = disabled; } catch (Exception e) { throw new GraniteConfigException("Could not instantiate instanceof matcher parent class: " + type, e); } }
public TideComponentAnnotatedWithMatcher(String type, boolean disabled) { try { annotationClass = TypeUtil.forName(type, Annotation.class); this.disabled = disabled; } catch (Exception e) { throw new GraniteConfigException("Could not instantiate instanceof matcher parent class: " + type, e); } }
public TideComponentAnnotatedWithMatcher(String type, boolean disabled) { try { annotationClass = TypeUtil.forName(type, Annotation.class); this.disabled = disabled; } catch (Exception e) { throw new GraniteConfigException("Could not instantiate instanceof matcher parent class: " + type, e); } }
public TideComponentInstanceOfMatcher(String type, boolean disabled) { try { parentClass = TypeUtil.forName(type); this.disabled = disabled; } catch (Exception e) { throw new GraniteConfigException("Could not instantiate instanceof matcher parent class: " + type, e); } }
public Class<? extends JavaClassDescriptor> getInstance(String type, Config config) throws GraniteConfigException { try { return TypeUtil.forName(type, JavaClassDescriptor.class); } catch (Exception e) { throw new GraniteConfigException("Could not load JavaClassDescriptor type: " + type, e); } }
public Class<? extends JavaClassDescriptor> getInstance(String type, Config config) throws GraniteConfigException { try { return TypeUtil.forName(type, JavaClassDescriptor.class); } catch (Exception e) { throw new GraniteConfigException("Could not load JavaClassDescriptor type: " + type, e); } }
public Class<? extends ActionScriptClassDescriptor> getInstance(String type, Config config) throws GraniteConfigException { try { return TypeUtil.forName(type, ActionScriptClassDescriptor.class); } catch (Exception e) { throw new GraniteConfigException("Could not load ActionScriptClassDescriptor type: " + type, e); } }
public Class<? extends ActionScriptClassDescriptor> getInstance(String type, Config config) throws GraniteConfigException { try { return TypeUtil.forName(type, ActionScriptClassDescriptor.class); } catch (Exception e) { throw new GraniteConfigException("Could not load ActionScriptClassDescriptor type: " + type, e); } }
public Class<? extends JavaClassDescriptor> getInstance(String type, Config config) throws GraniteConfigException { try { return TypeUtil.forName(type, JavaClassDescriptor.class); } catch (Exception e) { throw new GraniteConfigException("Could not load JavaClassDescriptor type: " + type, e); } }
public Class<? extends JavaClassDescriptor> getInstance(String type, GraniteConfig config) throws GraniteConfigException { try { return TypeUtil.forName(type, JavaClassDescriptor.class); } catch (Exception e) { throw new GraniteConfigException("Could not load JavaClassDescriptor type: " + type, e); } }
public static Constructor<?> getConstructor(String type, Class<?>[] paramTypes) throws ClassNotFoundException, NoSuchMethodException { return getConstructor(forName(type), paramTypes); }
@Override public InstanceStore createStore(Context context, InstanceFactory instanceFactory) { try { TypeUtil.forName("javax.inject.Inject"); return new SimpleInjectInstanceStore(context, instanceFactory); } catch (ClassNotFoundException e) { return new SimpleInstanceStore(context, instanceFactory); } } }