package com.yammer.metrics.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * An annotation for marking a method of an annotated object as metered.
 * <p/>
 * Given a method like this:
 * <pre><code>
 *     \@ExceptionMetered(name = "fancyName", cause=IllegalArgumentException.class)
 *     public String fancyName(String name) {
 *         return "Sir Captain " + name;
 *     }
 * </code></pre>
 * <p/>
 * A meter for the defining class with the name {@code fancyName} will be created and each time the
 * {@code #fancyName(String)} throws an exception of type {@code cause} (or a subclass), the meter
 * will be marked.
 * <p/>
 * By default, the annotation default to capturing all exceptions (subclasses of {@link Exception})
 * and will use the default event-type of "exceptions".
 * <p/>
 * A name for the metric can be specified as an annotation parameter, otherwise, the metric will be
 * named based on the method name.
 * <p/>
 * For instance, given a declaration of
 * <pre><code>
 *     \@ExceptionMetered
 *     public String fancyName(String name) {
 *         return "Sir Captain " + name;
 *     }
 * </code></pre>
 * <p/>
 * A meter named {@code fancyNameExceptionMetric} will be created with event-type named
 * "exceptions". The meter will be marked every time an exception is thrown.
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ExceptionMetered {
    /**
     * The default suffix for meter names.
     */
    String DEFAULT_NAME_SUFFIX = "exceptions";

    /**
     * The name of the meter. If not specified, the meter will be given a name based on the method
     * it decorates and the suffix "Exceptions".
     */
    String name() default "";

    /**
     * If {@code true}, use the given name an as absolute name. If {@code false}, use the given name
     * relative to the annotated class.
     */
    boolean absolute() default false;

    /**
     * The type of exceptions that the meter will catch and count.
     */
    Class<? extends Throwable> cause() default Exception.class;
}

@@ -759,172 +759,8 @@
 p/%3E%0A
- * By default, the annotation default to capturing all exceptions (subclasses of %7B@link Exception%7D)%0A * and will use the default event-type of %22exceptions%22.%0A * %3Cp/%3E%0A
  * A
@@ -1133,25 +1133,26 @@
 ancyName
-E
+.e
 xception
 Metric%7D 
@@ -1147,14 +1147,9 @@
 tion
-Metric
+s
 %7D wi
@@ -1166,64 +1166,11 @@
 ted 
-with event-type named%0A * %22exceptions%22. The meter will be
+and
  mar
@@ -1199,16 +1199,19 @@
 ption is
+%0A *
  thrown.

Fix some docs.