package org.x2a.cutter.annotation;

import org.x2a.cutter.cut.Advice;
import org.x2a.cutter.cut.JoinPoint;
import org.x2a.cutter.cut.Parameter;

import java.lang.annotation.*;

@Documented
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.METHOD)
public @interface Cut {
    Class<? extends Advice> value();

    final class Utils { //this class exists to solve potential import problems
        public static Parameter wrapParameter(final String name, final Class<?> clazz, final Object val) {
            return new Parameter(name, clazz, val);
        }

        /**
         * @param values {"name1", clazz1, val1, "name2", clazz2, val2}
         */
        public static Parameter[] toParameters(Object[] values) {
            Parameter[] parameters = new Parameter[values.length / 3];
            for (int i = 0; i < values.length; i += 3) {
                String name = (String) values[i];
                Class<?> clazz = (Class<?>) values[i + 1];
                Object val = values[i + 2];
                parameters[i / 3] = new Parameter(name, clazz, val);
            }
            return parameters;
        }

        public static JoinPoint createJoinPoint(Class<?> clazz, String methodName) {
            return new JoinPoint(clazz, methodName);
        }
    }
}

@@ -170,16 +170,223 @@
 ion.*;%0A%0A
+/**%0A * Add to a method to create a Pointcut that will intercept program execution and trigger the corresponding%0A * %7B@link Advice%7D methods.%0A * %3Cp%3E%0A * %3Cbold%3EDOES NOT SUPPORT ANONYMOUS INNER CLASSES%3C/bold%3E%0A */%0A
 @Documen

add javadoc to Cut