package com.codahale.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 a gauge.

Given a method like this:

 @Gauge(name = "queueSize") public int getQueueSize() { return queue.size; } 

A gauge for the defining class with the name queueSize will be created which uses the annotated method's return value as its value.

/** * An annotation for marking a method of an annotated object as a gauge. * <p> * Given a method like this: * <pre><code> * {@literal @}Gauge(name = "queueSize") * public int getQueueSize() { * return queue.size; * } * </code></pre> * <p> * A gauge for the defining class with the name {@code queueSize} will be created which uses the * annotated method's return value as its value. */
@Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE }) public @interface Gauge {
Returns:The gauge's name.
/** * @return The gauge's name. */
String name() default "";
Returns:If true, use the given name as an absolute name. If false, use the given name relative to the annotated class.
/** * @return If {@code true}, use the given name as an absolute name. If {@code false}, use the given name * relative to the annotated class. */
boolean absolute() default false; }