private Formatter createFormatter(Method method, Class<?>[] sig, int prio)
    {
        if (method.getReturnType() != Component.class)
        {
            throw new InvalidFormatMethodException(getClass(), method, "Format methods must return Component!");
        }

        final Invoker invoker;
        if (sig.length == 1)
        {
            invoker = new InputOnly();
        }
        else if (sig.length == 2)
        {
            if (sig[1] == Context.class)
            {
                invoker = new ContextOnly();
            }
            else if (sig[1] == Arguments.class)
            {
                invoker = new ArgsOnly();
            }
            else
            {
                throw new InvalidFormatMethodException(getClass(), method,
                                                       "Format methods may only take Context and Arguments parameters!");
            }
        }
        else if (sig.length == 3)
        {
            if (sig[1] == Context.class && sig[2] == Arguments.class)
            {
                invoker = new CompleteContextFirst();
            }
            else if (sig[1] == Arguments.class && sig[2] == Context.class)
            {
                invoker = new CompleteArgsFirst();
            }
            else
            {
                throw new InvalidFormatMethodException(getClass(), method,
                                                       "Format methods may only take Context and Arguments parameters!");
            }
        }
        else
        {
            throw new InvalidFormatMethodException(getClass(), method,
                                                   "Format methods must take at most 3 parameters!");
        }
        return new Formatter(this, method, prio, invoker);
    }
private Formatter createFormatter ( Method method , Class < ? > [ ] sig , int prio ) { if ( method . getReturnType ( ) != Component . class ) { throw new InvalidFormatMethodException ( getClass ( ) , method , "Format methods must return Component!" ) ; } final Invoker invoker ; if ( sig . length == 1 ) { invoker = new InputOnly ( ) ; } else if ( sig . length == 2 ) { if ( sig [ 1 ] == Context . class ) { invoker = new ContextOnly ( ) ; } else if ( sig [ 1 ] == Arguments . class ) { invoker = new ArgsOnly ( ) ; } else { throw new InvalidFormatMethodException ( getClass ( ) , method , "Format methods may only take Context and Arguments parameters!" ) ; } } else if ( sig . length == 3 ) { if ( sig [ 1 ] == Context . class && sig [ 2 ] == Arguments . class ) { invoker = new CompleteContextFirst ( ) ; } else if ( sig [ 1 ] == Arguments . class && sig [ 2 ] == Context . class ) { invoker = new CompleteArgsFirst ( ) ; } else { throw new InvalidFormatMethodException ( getClass ( ) , method , "Format methods may only take Context and Arguments parameters!" ) ; } } else { throw new InvalidFormatMethodException ( getClass ( ) , method , "Format methods must take at most 3 parameters!" ) ; } return new Formatter ( this , method , prio , invoker ) ; }
Creates a {@link Formatter} executing a {@link Format} method.

@param method The {@link Format} method.
@param sig The method input parameter type.
@param prio The priority of this formatter.

@return A {@link Formatter} object.