/** * Caches list of fields with given annotation from given class. * * @param cls Class the fields belong to. * @param annCls Annotation class for the fields. * @param fields Fields to cache. */ private void cacheFields(Class<?> cls, Class<? extends Annotation> annCls, Collection<Field> fields) { assert cls != null; assert annCls != null; assert fields != null; Map<Class<? extends Annotation>, Collection<Field>> annFields = F.addIfAbsent(fieldCache, cls, F.<Class<? extends Annotation>, Collection<Field>>newCMap()); assert annFields != null; annFields.put(annCls, fields); }
/** * Caches list of methods with given annotation from given class. * * @param cls Class the fields belong to. * @param annCls Annotation class for the fields. * @param mtds Methods to cache. */ private void cacheMethods(Class<?> cls, Class<? extends Annotation> annCls, Collection<Method> mtds) { assert cls != null; assert annCls != null; assert mtds != null; Map<Class<? extends Annotation>, Collection<Method>> annMtds = F.addIfAbsent(mtdCache, cls, F.<Class<? extends Annotation>, Collection<Method>>newCMap()); assert annMtds != null; annMtds.put(annCls, mtds); }
/** * Caches list of fields with given annotation from given class. * * @param cls Class the fields belong to. * @param dep Deployment. * @param annCls Annotation class for the fields. * @param fields Fields to cache. */ private void cacheFields(@Nullable GridDeployment dep, Class<?> cls, Class<? extends Annotation> annCls, List<GridResourceField> fields) { if (dep != null) { Set<Class<?>> classes = F.addIfAbsent(taskMap, dep.classLoader(), F.<Class<?>>newCSet()); assert classes != null; classes.add(cls); } Map<Class<? extends Annotation>, List<GridResourceField>> rsrcFields = F.addIfAbsent(fieldCache, cls, F.<Class<? extends Annotation>, List<GridResourceField>>newCMap()); assert rsrcFields != null; rsrcFields.put(annCls, fields); }
/** * Caches list of methods with given annotation from given class. * * @param rsrcCls Class the fields belong to. * @param dep Deployment. * @param annCls Annotation class for the fields. * @param mtds Methods to cache. */ private void cacheMethods(@Nullable GridDeployment dep, Class<?> rsrcCls, Class<? extends Annotation> annCls, List<GridResourceMethod> mtds) { if (dep != null) { Set<Class<?>> classes = F.addIfAbsent(taskMap, dep.classLoader(), F.<Class<?>>newCSet()); assert classes != null; classes.add(rsrcCls); } Map<Class<? extends Annotation>, List<GridResourceMethod>> rsrcMtds = F.addIfAbsent(mtdCache, rsrcCls, F.<Class<? extends Annotation>, List<GridResourceMethod>>newCMap()); assert rsrcMtds != null; rsrcMtds.put(annCls, mtds); }