private Set<String> getSortedMethods(final Class<?> clazz, final Method[] methods)
    {
        final Set<String> sortedMethodNames = sortedMethods.get(clazz);
        if (null == sortedMethodNames)
        {
            final GroupOrder order = clazz.getAnnotation(GroupOrder.class);
            if (null == order)
            {
                sortedMethods.put(clazz, Collections.emptySet());

                return Collections.emptySet();
            }
            else
            {
                final Set<String> result = new LinkedHashSet<>();
                for (final Class<?> groupClazz : order.value())
                {
                    for (final Method method : methods)
                    {
                        if (method.getReturnType() == groupClazz && method.getParameterTypes().length == 0)
                        {
                            result.add(method.getName());
                        }
                    }
                }
                sortedMethods.put(clazz, result);

                return result;
            }
        }

        return sortedMethodNames;
    }
Select a list of methods from a given class.

@param clazz to select the method for.
@return the list of methods
sbe-tool/src/main/java/uk/co/real_logic/sbe/codec/java/MethodSelector.java