/*
 * RoutingMethodParser.java
 *
 * Copyright (c) 2014. Graham Howden <graham_howden1 at yahoo.co.uk>.
 *
 * This file is part of PluginFramework.
 *
 * PluginFramework is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * PluginFramework is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with PluginFramework.  If not, see <http ://www.gnu.org/licenses/>.
 */

package com.publicuhc.pluginframework.routing.parser;

import com.publicuhc.pluginframework.routing.CommandRoute;
import com.publicuhc.pluginframework.routing.exception.CommandParseException;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

public abstract class RoutingMethodParser
{

    /**
     * @param annotation the annotation to look for
     * @return annotation if found, null otherwise
     */
    public static <T extends Annotation> T getAnnotation(Method method, Class<T> annotation)
    {
        return method.getAnnotation(annotation);
    }

    /**
     * @param method   the method to parse
     * @param instance the instance to use
     * @return the proxy built from the given method
     * @throws com.publicuhc.pluginframework.routing.exception.CommandParseException if errors were thrown during parse
     */
    public abstract CommandRoute parseCommandMethodAnnotation(Method method, Object instance) throws CommandParseException;

    /**
     * Check if the given method has the command method annotation
     *
     * @param method the method to check
     */
    public abstract boolean hasCommandMethodAnnotation(Method method);
}
/*
 * RoutingMethodParser.java
 *
 * Copyright (c) 2014. Graham Howden <graham_howden1 at yahoo.co.uk>.
 *
 * This file is part of PluginFramework.
 *
 * PluginFramework is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * PluginFramework is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with PluginFramework.  If not, see <http ://www.gnu.org/licenses/>.
 */

package com.publicuhc.pluginframework.routing.parser;

import com.publicuhc.pluginframework.routing.CommandRoute;
import com.publicuhc.pluginframework.routing.exception.CommandParseException;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

public abstract class RoutingMethodParser
{

    /**
     * @param annotation the annotation to look for
     * @return true if found, false otherwise
     */
    public static <T extends Annotation> T getAnnotation(Method method, Class<T> annotation)
    {
        return method.getAnnotation(annotation);
    }

    /**
     * @param method   the method to parse
     * @param instance the instance to use
     * @return the proxy built from the given method
     * @throws com.publicuhc.pluginframework.routing.exception.CommandParseException if errors were thrown during parse
     */
    public abstract CommandRoute parseCommandMethodAnnotation(Method method, Object instance) throws CommandParseException;

    /**
     * Check if the given method has the command method annotation
     *
     * @param method the method to check
     */
    public abstract boolean hasCommandMethodAnnotation(Method method);
}
Revert "incorrect doc"