/** * get parameter names of given {@code constructor} * * <p>depends on MethodParameterNamesScanner configured */ public List<String> getConstructorParamNames(Constructor constructor) { Iterable<String> names = store.get(index(MethodParameterNamesScanner.class), Utils.name(constructor)); return !Iterables.isEmpty(names) ? Arrays.asList(Iterables.getOnlyElement(names).split(", ")) : Arrays.<String>asList(); }
@Override public synchronized Collection<AbstractCompactionTask> getMaximalTask(int gcBefore) { Iterable<SSTableReader> sstables = cfs.markAllCompacting(); if (sstables == null) return null; return Arrays.<AbstractCompactionTask>asList( new CompactionTask(cfs, sstables, gcBefore, false)); }
private void writeDelegateMethods( final ClassVisitor visitor, final Type generatedType, StructSchema<?> delegateSchema, Set<Class<?>> typesToDelegate) { Class<?> delegateClass = delegateSchema.getType().getConcreteClass(); Type delegateType = Type.getType(delegateClass); Map<Equivalence.Wrapper<Method>, Map<Class<?>, Method>> methodsToDelegate = Maps.newHashMap(); for (Class<?> typeToDelegate : typesToDelegate) { for (Method methodToDelegate : typeToDelegate.getMethods()) { if (ModelSchemaUtils.isIgnoredMethod(methodToDelegate)) { continue; } Equivalence.Wrapper<Method> methodKey = METHOD_EQUIVALENCE.wrap(methodToDelegate); Map<Class<?>, Method> methodsByReturnType = methodsToDelegate.get(methodKey); if (methodsByReturnType == null) { methodsByReturnType = Maps.newHashMap(); methodsToDelegate.put(methodKey, methodsByReturnType); } methodsByReturnType.put(methodToDelegate.getReturnType(), methodToDelegate); } } Set<Equivalence.Wrapper<Method>> delegateMethodKeys = ImmutableSet.copyOf( Iterables.transform( Arrays.asList(delegateClass.getMethods()), new Function<Method, Equivalence.Wrapper<Method>>() { @Override public Equivalence.Wrapper<Method> apply(Method method) { return METHOD_EQUIVALENCE.wrap(method); } })); for (Map.Entry<Equivalence.Wrapper<Method>, Map<Class<?>, Method>> entry : methodsToDelegate.entrySet()) { Equivalence.Wrapper<Method> methodKey = entry.getKey(); if (!delegateMethodKeys.contains(methodKey)) { continue; } Map<Class<?>, Method> methodsByReturnType = entry.getValue(); for (Method methodToDelegate : methodsByReturnType.values()) { writeDelegatedMethod(visitor, generatedType, delegateType, methodToDelegate); } } }
/** * get parameter names of given {@code method} * * <p>depends on MethodParameterNamesScanner configured */ public List<String> getMethodParamNames(Method method) { Iterable<String> names = store.get(index(MethodParameterNamesScanner.class), name(method)); return !Iterables.isEmpty(names) ? Arrays.asList(Iterables.getOnlyElement(names).split(", ")) : Arrays.<String>asList(); }
/** * gets all sub types in hierarchy of a given type * * <p>depends on SubTypesScanner configured */ public <T> Set<Class<? extends T>> getSubTypesOf(final Class<T> type) { return Sets.newHashSet( ReflectionUtils.<T>forNames( store.getAll(index(SubTypesScanner.class), Arrays.asList(type.getName())), loaders())); }
private void addFieldMappers(FieldMapper[] fieldMappers) { synchronized (mappersMutex) { this.fieldMappers.addNewMappers(Arrays.asList(fieldMappers)); } }
@Deprecated public Range<Token> getPrimaryRangeFor(Token right) { return getPrimaryRangesFor(Arrays.asList(right)).iterator().next(); }