@Override public Class rawType() { if (null == rawType) { synchronized (this) { if (null == rawType) { rawType = rawTypeOf(type); } } } return rawType; }
@Override public Class rawType() { if (null == rawType) { synchronized (this) { if (null == rawType) { rawType = rawTypeOf(type); } } } return rawType; }
@Override public Object load(Object bean, ActContext<?> context, boolean noDefaultValue) { List list = new ArrayList(); if (null != bean) { int len = Array.getLength(bean); for (int i = 0; i < len; ++i) { list.add(Array.get(bean, i)); } } list = (List) collectionLoader.load(list, context, false); return null == list ? null : ArrayLoader.listToArray(list, BeanSpec.rawTypeOf(elementType)); }
@Override public Object load(Object bean, ActContext<?> context, boolean noDefaultValue) { List list = new ArrayList(); if (null != bean) { int len = Array.getLength(bean); for (int i = 0; i < len; ++i) { list.add(Array.get(bean, i)); } } list = (List) collectionLoader.load(list, context, false); return null == list ? null : ArrayLoader.listToArray(list, BeanSpec.rawTypeOf(elementType)); }
@Override public MorphiaDaoBase load(BeanSpec beanSpec) { List<Type> typeList = beanSpec.typeParams(); int sz = typeList.size(); if (sz > 1) { Class<?> modelType = BeanSpec.rawTypeOf(typeList.get(1)); return (MorphiaDaoBase) dbServiceManager.dao(modelType); } return null; } }
@Override public JPADao load(BeanSpec beanSpec) { List<Type> typeList = beanSpec.typeParams(); int sz = typeList.size(); if (sz > 1) { Class<?> modelType = BeanSpec.rawTypeOf(typeList.get(1)); return (JPADao) dbServiceManager.dao(modelType); } return null; } }
@Override public DaoBase load(BeanSpec spec) { List<Type> typeList = spec.typeParams(); int sz = typeList.size(); if (sz > 1) { Class<?> modelType = BeanSpec.rawTypeOf(typeList.get(1)); return (DaoBase) dbServiceManager.dao(modelType); } return null; }
private Class rawTypeOf(Type type, Map<String, Class> typeParamImplLookup) { if (type instanceof Class) { return (Class) type; } else if (type instanceof ParameterizedType) { return (Class) ((ParameterizedType) type).getRawType(); } else if (type instanceof TypeVariable) { TypeVariable tv = (TypeVariable) type; Class impl = typeParamImplLookup.get(tv.getName()); if (null != impl) { return impl; } } else if (type instanceof GenericArrayType) { GenericArrayType gat = (GenericArrayType) type; Type componentType = gat.getGenericComponentType(); return rawTypeOf(componentType, typeParamImplLookup); } throw E.unexpected("type not recognized: %s", type); }
private Class rawTypeOf(Type type, Map<String, Class> typeParamImplLookup) { if (type instanceof Class) { return (Class) type; } else if (type instanceof ParameterizedType) { return (Class) ((ParameterizedType) type).getRawType(); } else if (type instanceof TypeVariable) { TypeVariable tv = (TypeVariable) type; Class impl = typeParamImplLookup.get(tv.getName()); if (null != impl) { return impl; } } else if (type instanceof GenericArrayType) { GenericArrayType gat = (GenericArrayType) type; Type componentType = gat.getGenericComponentType(); return rawTypeOf(componentType, typeParamImplLookup); } throw E.unexpected("type not recognized: %s", type); }
@Override public EbeanDao load(BeanSpec beanSpec) { List<Type> typeList = beanSpec.typeParams(); int sz = typeList.size(); if (sz > 1) { Class<?> modelType = BeanSpec.rawTypeOf(typeList.get(1)); return (EbeanDao) dbServiceManager.dao(modelType); } return null; } }
@Override public EbeanDao load(BeanSpec beanSpec) { List<Type> typeList = beanSpec.typeParams(); int sz = typeList.size(); if (sz > 1) { Class<?> modelType = BeanSpec.rawTypeOf(typeList.get(1)); return (EbeanDao) dbServiceManager.dao(modelType); } return null; } }
@Override public DaoBase load(BeanSpec spec) { List<Type> typeList = spec.typeParams(); int sz = typeList.size(); if (sz > 1) { Class<?> modelType = BeanSpec.rawTypeOf(typeList.get(1)); return (DaoBase) dbServiceManager.dao(modelType); } return null; }
@Override public EbeanDao load(BeanSpec beanSpec) { List<Type> typeList = beanSpec.typeParams(); int sz = typeList.size(); if (sz > 1) { Class<?> modelType = BeanSpec.rawTypeOf(typeList.get(1)); return (EbeanDao) dbServiceManager.dao(modelType); } return null; } }
@Override public MorphiaDaoWithLongId load(BeanSpec beanSpec) { List<Type> typeList = beanSpec.typeParams(); int sz = typeList.size(); if (sz > 0) { Class<?> modelType = BeanSpec.rawTypeOf(typeList.get(0)); return (MorphiaDaoWithLongId) dbServiceManager.dao(modelType); } return null; } }
@Override public MorphiaDao load(BeanSpec beanSpec) { List<Type> typeList = beanSpec.typeParams(); int sz = typeList.size(); if (sz > 0) { Class<?> modelType = BeanSpec.rawTypeOf(typeList.get(0)); return (MorphiaDao) dbServiceManager.dao(modelType); } return null; } }
@Override public Dao load(BeanSpec spec) { List<Type> typeList = spec.typeParams(); int sz = typeList.size(); if (sz > 1) { Class<?> modelType = BeanSpec.rawTypeOf(typeList.get(1)); return dbServiceManager.dao(modelType); } return (Dao)Act.getInstance(spec.rawType()); }
@Override public Dao load(BeanSpec spec) { List<Type> typeList = spec.typeParams(); int sz = typeList.size(); if (sz > 1) { Class<?> modelType = BeanSpec.rawTypeOf(typeList.get(1)); return dbServiceManager.dao(modelType); } return (Dao)Act.getInstance(spec.rawType()); }
private BeanSpec(Type type, Annotation[] annotations, String name, Injector injector, int modifiers, Map<String, Class> typeParamImplLookup) { this.injector = injector; this.type = type; this.originalName = name; this.name = name; this.rawType = rawTypeOf(type, typeParamImplLookup); this.typeParams(typeParamImplLookup); if (null != typeParamImplLookup && type instanceof TypeVariable && rawType.getTypeParameters().length > 0 && !typeParamImplLookup.isEmpty()) { this.fieldTypeImplLookup = Generics.subLookup(typeParamImplLookup, ((TypeVariable) type).getName()); } this.isArray = rawType.isArray(); this.resolveTypeAnnotations(injector); this.resolveAnnotations(annotations, injector, typeParamImplLookup); this.hc = calcHashCode(); this.modifiers = modifiers; }
private BeanSpec(Type type, Annotation[] annotations, String name, Injector injector, int modifiers, Map<String, Class> typeParamImplLookup) { this.injector = injector; this.type = type; this.originalName = name; this.name = name; this.rawType = rawTypeOf(type, typeParamImplLookup); this.typeParams(typeParamImplLookup); if (null != typeParamImplLookup && type instanceof TypeVariable && rawType.getTypeParameters().length > 0 && !typeParamImplLookup.isEmpty()) { this.fieldTypeImplLookup = Generics.subLookup(typeParamImplLookup, ((TypeVariable) type).getName()); } this.isArray = rawType.isArray(); this.resolveTypeAnnotations(injector); this.resolveAnnotations(annotations, injector, typeParamImplLookup); this.hc = calcHashCode(); this.modifiers = modifiers; }
CollectionLoader( ParamKey key, Class<? extends Collection> collection, Type elementType, BeanSpec targetSpec, DependencyInjector<?> injector, ParamValueLoaderService manager ) { this.key = key; this.collectionClass = collection; this.elementType = elementType; this.isChar = char.class == elementType || Character.class == elementType; this.injector = injector; this.manager = manager; App app = Act.app(); Class<?> rawType = BeanSpec.rawTypeOf(elementType); this.binder = app.binderManager().binder(rawType); this.targetSpec = targetSpec; if (null == binder) { this.resolver = App.instance().resolverManager().resolver(rawType, targetSpec); } else { this.resolver = null; } // if (null == this.binder && null == this.resolver) { // throw new IllegalArgumentException(S.fmt("Cannot find binder and resolver for %s", elementType)); // } }