private static String toString(BeanSpec spec) { if (spec.typeParams().isEmpty()) { return spec.rawType().getName(); } else { return spec.type().toString(); } }
private ParamValueLoader paramValueLoaderOf(BeanSpec spec, String bindName, ActContext ctx) { Class<?> rawType = spec.rawType(); if (Result.class.isAssignableFrom(rawType)) { return RESULT_LOADER; } else if (Throwable.class.isAssignableFrom(rawType)) { return new ThrowableLoader((Class<? extends Throwable>) rawType); } else if (Annotation.class.isAssignableFrom(rawType)) { return findHandlerMethodAnnotation((Class<? extends Annotation>) rawType, ctx); } Type type = spec.type(); Annotation[] annotations = spec.allAnnotations(); $.T2<Type, Annotation[]> key = $.T2(type, annotations); ParamValueLoader loader = paramRegistry.get(key); if (null == loader) { ParamValueLoader newLoader = findLoader(bindName, spec); if (null != newLoader) { // Cannot use spec as the key here because // spec does not compare Scoped annotation loader = paramRegistry.putIfAbsent(key, newLoader); if (null == loader) { loader = newLoader; } } } return loader; }
private static String toString(BeanSpec spec) { if (spec.typeParams().isEmpty()) { return spec.rawType().getName(); } else { return spec.type().toString(); } }
private static String key(List<BeanSpec> beanSpecs) { S.Buffer sb = S.buffer(); for (BeanSpec beanSpec : beanSpecs) { sb.append(beanSpec.name()).append(beanSpec.type().hashCode()); } return sb.toString(); }
ParamValueLoader buildLoader(final ParamKey key, BeanSpec spec) { Type type = spec.type(); Class rawType = spec.rawType(); if (rawType.isArray()) {
private static String key(List<BeanSpec> beanSpecs) { S.Buffer sb = S.buffer(); for (BeanSpec beanSpec : beanSpecs) { sb.append(beanSpec.name()).append(beanSpec.type().hashCode()); } return sb.toString(); }
ParamValueLoader buildLoader(final ParamKey key, BeanSpec spec) { Type type = spec.type(); Class rawType = spec.rawType(); if (rawType.isArray()) {
private ParamValueLoader paramValueLoaderOf(BeanSpec spec, String bindName, ActContext ctx) { Class<?> rawType = spec.rawType(); if (Result.class.isAssignableFrom(rawType)) { return RESULT_LOADER; } else if (Throwable.class.isAssignableFrom(rawType)) { return new ThrowableLoader((Class<? extends Throwable>) rawType); } else if (Annotation.class.isAssignableFrom(rawType)) { return findHandlerMethodAnnotation((Class<? extends Annotation>) rawType, ctx); } Type type = spec.type(); Annotation[] annotations = spec.allAnnotations(); $.T2<Type, Annotation[]> key = $.T2(type, annotations); ParamValueLoader loader = paramRegistry.get(key); if (null == loader) { ParamValueLoader newLoader = findLoader(bindName, spec); if (null != newLoader) { // Cannot use spec as the key here because // spec does not compare Scoped annotation loader = paramRegistry.putIfAbsent(key, newLoader); if (null == loader) { loader = newLoader; } } } return loader; }
boolean isReturn ) { Type type = spec.type(); if (void.class == type) { return null;
@Override public String toString() { StringBuilder sb = S.builder(type()); if (S.notBlank(name)) { sb.append("(").append(name).append(")"); } C.List<Object> list = C.newList(); if (null != valueLoader) { list.append(valueLoader); } else { list.append(qualifiers).append(elementLoaders).append(filters); if (null != mapKey) { list.append(mapKey); } } if (null != scope) { list.append(scope.getSimpleName()); } if (!list.isEmpty()) { sb.append("@[").append(S.join(", ", list)).append("]"); } return sb.toString(); }
content = content.trim(); Object o = content.startsWith("[") ? JSON.parseArray(content) : JSON.parseObject(content); return $.map(o).targetGenericType(spec.type()).to(rawType); return $.map(o).targetGenericType(spec.type()).to(rawType); if ($.isCollectionType(rawType)) { JSONArray array = $.convert(o).to(JSONArray.class); return $.map(array).targetGenericType(spec.type()).to(rawType); } else { JSONObject json = $.convert(o).to(JSONObject.class); return $.map(json).targetGenericType(spec.type()).to(rawType); return properties; return $.map(properties).targetGenericType(spec.type()).to(rawType); } else {
@Override public String toString() { StringBuilder sb = S.builder(type()); if (S.notBlank(name)) { sb.append("(").append(name).append(")"); } C.List<Object> list = C.newList(); if (null != valueLoader) { list.append(valueLoader); } else { list.append(qualifiers).append(elementLoaders).append(filters); if (null != mapKey) { list.append(mapKey); } } if (null != scope) { list.append(scope.getSimpleName()); } if (!list.isEmpty()) { sb.append("@[").append(S.join(", ", list)).append("]"); } return sb.toString(); }
content = content.trim(); Object o = content.startsWith("[") ? JSON.parseArray(content) : JSON.parseObject(content); return $.map(o).targetGenericType(spec.type()).to(rawType); return $.map(o).targetGenericType(spec.type()).to(rawType); if ($.isCollectionType(rawType)) { JSONArray array = $.convert(o).to(JSONArray.class); return $.map(array).targetGenericType(spec.type()).to(rawType); } else { JSONObject json = $.convert(o).to(JSONObject.class); return $.map(json).targetGenericType(spec.type()).to(rawType); return properties; return $.map(properties).targetGenericType(spec.type()).to(rawType); } else {
public StringValueResolverValueLoaderBase(ParamKey key, DefaultValue def, BeanSpec spec, boolean simpleKeyOnly) { E.illegalArgumentIf(simpleKeyOnly && !key.isSimple()); this.paramSpec = spec; this.param = spec.getAnnotation(Param.class); this.paramKey = key; this.defSpec = def; this.resolverManager = Act.app().resolverManager(); this.injector = Act.app().injector(); this.requireRuntimeType = !(spec.type() instanceof Class); this.stringValueResolver = this.requireRuntimeType ? null : lookupResolver(spec, spec.rawType()); this.defVal = this.requireRuntimeType ? null : null != def ? this.stringValueResolver.resolve(def.value()) : defVal(param, spec.rawType()); }
boolean isReturn ) { Type type = spec.type(); if (void.class == type) { return null;
public StringValueResolverValueLoaderBase(ParamKey key, DefaultValue def, BeanSpec spec, boolean simpleKeyOnly) { E.illegalArgumentIf(simpleKeyOnly && !key.isSimple()); this.paramSpec = spec; this.param = spec.getAnnotation(Param.class); this.paramKey = key; this.defSpec = def; this.resolverManager = Act.app().resolverManager(); this.injector = Act.app().injector(); this.requireRuntimeType = !(spec.type() instanceof Class); this.stringValueResolver = this.requireRuntimeType ? null : lookupResolver(spec, spec.rawType()); this.defVal = this.requireRuntimeType ? null : null != def ? this.stringValueResolver.resolve(def.value()) : defVal(param, spec.rawType()); }