Java Code Examples for org.osgl.util.Generics#buildTypeParamImplLookup()
The following examples show how to use
org.osgl.util.Generics#buildTypeParamImplLookup() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataPropertyRepository.java From actframework with Apache License 2.0 | 6 votes |
private List<S.Pair> propertyListOf(Class<?> c, Set<Class<?>> circularReferenceDetector, Map<String, Class> typeImplLookup) { if (null == typeImplLookup) { typeImplLookup = Generics.buildTypeParamImplLookup(c); } else { typeImplLookup.putAll(Generics.buildTypeParamImplLookup(c)); } if (circularReferenceDetector.contains(c)) { return C.list(); } circularReferenceDetector.add(c); try { return buildPropertyList(c, circularReferenceDetector, typeImplLookup); } finally { circularReferenceDetector.remove(c); } }
Example 2
Source File: GH43.java From java-di with Apache License 2.0 | 5 votes |
@Test public void test() { Genie genie = Genie.create(); Method method = $.getMethod(Foo.class, "doIt", List.class); Map<String, Class> typeVarLookup = Generics.buildTypeParamImplLookup(IntFoo.class); Type type = method.getGenericParameterTypes()[0]; Annotation[] anno = method.getParameterAnnotations()[0]; BeanSpec spec = BeanSpec.of(type, anno, genie, typeVarLookup); }
Example 3
Source File: SimpleRestfulServiceBase.java From actframework with Apache License 2.0 | 5 votes |
private void exploreTypes() { Map<String, Class> typeParamLookup = Generics.buildTypeParamImplLookup(getClass()); List<Type> types = Generics.typeParamImplementations(getClass(), SimpleRestfulServiceBase.class); int sz = types.size(); if (sz < 3) { throw new IllegalArgumentException("Cannot determine DAO type"); } Type daoType = types.get(2); BeanSpec spec = BeanSpec.of(daoType, Act.injector(), typeParamLookup); DaoLoader loader = Act.getInstance(DaoLoader.class); dao = $.cast(loader.load(spec)); }
Example 4
Source File: Gh196.java From java-tool with Apache License 2.0 | 5 votes |
@Test public void test() { Map<String, Class> lookup = Generics.buildTypeParamImplLookup(Me.class); eq(String.class, lookup.get("K")); eq(Integer.class, lookup.get("V")); eq(TreeMap.class, lookup.get("M")); }
Example 5
Source File: Gh197.java From java-tool with Apache License 2.0 | 5 votes |
@Test public void test() { Map<String, Class> lookup = Generics.buildTypeParamImplLookup(Me.class); eq(String.class, lookup.get("K")); eq(Integer.class, lookup.get("V")); eq(Req.class, lookup.get("RQ")); eq(String.class, lookup.get("RQ.V")); }