Preconditions.checkNotNull(services, "service is null");
Preconditions.checkArgument(!services.isEmpty(), "services is empty");
Map<String, ThriftMethodProcessor> processorMap = newHashMap();
for (Object service : services) {
ThriftServiceMetadata serviceMetadata = new ThriftServiceMetadata(service.getClass(), codecManager.getCatalog());
for (ThriftMethodMetadata methodMetadata : serviceMetadata.getMethods().values()) {
String methodName = methodMetadata.getName();
ThriftMethodProcessor methodProcessor = new ThriftMethodProcessor(service, serviceMetadata.getName(), methodMetadata, codecManager);
if (processorMap.containsKey(methodName)) {
throw new IllegalArgumentException("Multiple @ThriftMethod-annotated methods named '" + methodName + "' found in the given services");
}
processorMap.put(methodName, methodProcessor);
}