presto-main/src/main/java/io/prestosql/operator/aggregation/AggregationFromAnnotationsParser.java/AggregationFromAnnotationsParser/getAggregationStateSerializerFactory
class AggregationFromAnnotationsParser:    private static Optional<Method> getAggregationStateSerializerFactory(Class<?> aggregationDefinition, Class<?> stateClass)
    {
        // Only include methods that match this state class
        List<Method> stateSerializerFactories = FunctionsParserHelper.findPublicStaticMethodsWithAnnotation(aggregationDefinition, AggregationStateSerializerFactory.class).stream()
                .filter(method -> ((AggregationStateSerializerFactory) method.getAnnotation(AggregationStateSerializerFactory.class)).value().equals(stateClass))
                .collect(toImmutableList());

        if (stateSerializerFactories.isEmpty()) {
            return Optional.empty();
        }

        checkArgument(
                stateSerializerFactories.size() == 1,
                "Expect at most 1 @AggregationStateSerializerFactory(%s.class) annotation, found %s in %s",
                stateClass.toGenericString(),
                stateSerializerFactories.size(),
                aggregationDefinition.toGenericString());
        return Optional.of(getOnlyElement(stateSerializerFactories));
    }