public static boolean isThrowable(BeanSpec beanSpec) { return beanSpec.isInstanceOf(Throwable.class); }
public static boolean isThrowable(BeanSpec beanSpec) { return beanSpec.isInstanceOf(Throwable.class); }
private void initLoaders(App app) { java.lang.reflect.Type[] types = method.getGenericParameterTypes(); int len = types.length; ParamValueLoader[] loaders = new ParamValueLoader[len]; if (0 < len) { GenieInjector injector = app.injector(); Annotation[][] annos = method.getParameterAnnotations(); for (int i = 0; i < len; ++i) { java.lang.reflect.Type type = types[i]; Annotation[] aa = annos[i]; BeanSpec spec = BeanSpec.of(type, aa, injector); E.unexpectedIf(!injector.isProvided(spec), ""); loaders[i] = ProvidedValueLoader.get(spec, injector); if (spec.isInstanceOf(ActionContext.class) || requireAction(type)) { supportAction = true; } else if (spec.isInstanceOf(MailerContext.class)) { supportMailer = true; } } } if (!supportAction && !supportMailer) { supportAction = true; supportMailer = true; } this.loaders = loaders; this.paramLen = len; }
private void initLoaders(App app) { java.lang.reflect.Type[] types = method.getGenericParameterTypes(); int len = types.length; ParamValueLoader[] loaders = new ParamValueLoader[len]; if (0 < len) { GenieInjector injector = app.injector(); Annotation[][] annos = method.getParameterAnnotations(); for (int i = 0; i < len; ++i) { java.lang.reflect.Type type = types[i]; Annotation[] aa = annos[i]; BeanSpec spec = BeanSpec.of(type, aa, injector); E.unexpectedIf(!injector.isProvided(spec), ""); loaders[i] = ProvidedValueLoader.get(spec, injector); if (spec.isInstanceOf(ActionContext.class) || requireAction(type)) { supportAction = true; } else if (spec.isInstanceOf(MailerContext.class)) { supportMailer = true; } } } if (!supportAction && !supportMailer) { supportAction = true; supportMailer = true; } this.loaders = loaders; this.paramLen = len; }
private void setField(Field f, Object host, String key, Object val, BeanSpec spec) throws Exception { f.setAccessible(true); if (spec.isInstanceOf($.Val.class)) { $.Val value = $.cast(f.get(host)); Field fVal = $.Var.class.getDeclaredField("v"); setField(fVal, value, key, val, spec0); fVal.setAccessible(false); } else if (spec.isInstanceOf(Const.class)) { Const value = $.cast(f.get(host)); Field fConst = Const.class.getDeclaredField("v"); setField(fConst, value, key, val, spec0); fConst.setAccessible(false); } else if (spec.isInstanceOf(Collection.class)) { BeanSpec spec0 = BeanSpec.of(spec.typeParams().get(0), null, injector); StringValueResolver resolver = resolverManager.resolver(spec0.rawType(), spec);
private void setField(Field f, Object host, String key, Object val, BeanSpec spec) throws Exception { f.setAccessible(true); if (spec.isInstanceOf($.Val.class)) { $.Val value = $.cast(f.get(host)); Field fVal = $.Var.class.getDeclaredField("v"); setField(fVal, value, key, val, spec0); fVal.setAccessible(false); } else if (spec.isInstanceOf(Const.class)) { Const value = $.cast(f.get(host)); Field fConst = Const.class.getDeclaredField("v"); setField(fConst, value, key, val, spec0); fConst.setAccessible(false); } else if (spec.isInstanceOf(Collection.class)) { BeanSpec spec0 = BeanSpec.of(spec.typeParams().get(0), null, injector); StringValueResolver resolver = resolverManager.resolver(spec0.rawType(), spec);
public boolean isProvided(BeanSpec beanSpec) { Class rawType = beanSpec.rawType(); boolean provided = (ActProviders.isProvided(rawType) || null != beanSpec.getAnnotation(Inject.class) || null != beanSpec.getAnnotation(Provided.class) || null != beanSpec.getAnnotation(Context.class) || null != beanSpec.getAnnotation(Singleton.class) || beanSpec.isInstanceOf(SingletonBase.class) || subjectToInject(beanSpec) ); return provided && (!($.isSimpleType(rawType) && !beanSpec.hasAnnotation())); }
public boolean isProvided(BeanSpec beanSpec) { Class rawType = beanSpec.rawType(); boolean provided = (ActProviders.isProvided(rawType) || null != beanSpec.getAnnotation(Inject.class) || null != beanSpec.getAnnotation(Provided.class) || null != beanSpec.getAnnotation(Context.class) || null != beanSpec.getAnnotation(Singleton.class) || beanSpec.isInstanceOf(SingletonBase.class) || subjectToInject(beanSpec) ); return provided && (!($.isSimpleType(rawType) && !beanSpec.hasAnnotation())); }