Package com.codahale.metrics.annotation

Examples of com.codahale.metrics.annotation.Gauge


    @Override
    public <I> void hear(final TypeLiteral<I> literal, TypeEncounter<I> encounter) {
        Class<? super I> klass = literal.getRawType();
        for (final Method method : klass.getMethods()) {
            final Gauge annotation = method.getAnnotation(Gauge.class);
            if (annotation != null) {
                if (method.getParameterTypes().length == 0) {
                    final String metricName = determineName(annotation, klass, method);
                    encounter.register(new GaugeInjectionListener<I>(metricRegistry,
                        metricName,
View Full Code Here


  protected void withMethod(final Object bean, String beanName, Class<?> targetClass, final Method method) {
    if (method.getParameterTypes().length > 0) {
      throw new IllegalStateException("Method " + method.getName() + " is annotated with @Gauge but requires parameters.");
    }

    final Gauge annotation = method.getAnnotation(Gauge.class);
    final String metricName = Util.forGauge(targetClass, method, annotation);

    metrics.register(metricName, new com.codahale.metrics.Gauge<Object>() {
      @Override
      public Object getValue() {
View Full Code Here

  @Override
  protected void withField(final Object bean, String beanName, Class<?> targetClass, final Field field) {
    ReflectionUtils.makeAccessible(field);

    final Gauge annotation = field.getAnnotation(Gauge.class);
    final String metricName = Util.forGauge(targetClass, field, annotation);

    metrics.register(metricName, new com.codahale.metrics.Gauge<Object>() {
      @Override
      public Object getValue() {
View Full Code Here

  }

  @Override
  public <I> void hear(TypeLiteral<I> type, TypeEncounter<I> encounter) {
    for (final Method method : type.getRawType().getMethods()) {
      final Gauge annotation = method.getAnnotation(Gauge.class);

      if (annotation != null) {
        boolean validMethod = true;

        if (method.getParameterTypes().length != 0) {
View Full Code Here

TOP

Related Classes of com.codahale.metrics.annotation.Gauge

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.