org.apache.tinkerpop.gremlin.process.traversal.util

## Class ImmutableMetrics

- java.lang.Object
- - org.apache.tinkerpop.gremlin.process.traversal.util.ImmutableMetrics

- All Implemented Interfaces:
    Serializable, Metrics
  Direct Known Subclasses:
    MutableMetrics

      public class ImmutableMetrics
      extends Object
      implements Metrics, Serializable

  Author:
    Bob Briody (http://bobbriody.com)
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Map<String,Object>` | `annotations`
    `protected Map<String,AtomicLong>` | `counts`
    `protected long` | `durationNs`
    `protected String` | `id`
    `protected String` | `name`
    `protected Map<String,ImmutableMetrics>` | `nested`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ImmutableMetrics()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `getAnnotation(String key)` Obtain the annotation with the specified key.
    `Map<String,Object>` | `getAnnotations()` Obtain the annotations for this Metrics.
    `Long` | `getCount(String key)` Get the count for the corresponding countKey.
    `Map<String,Long>` | `getCounts()` Get the map of all counters.
    `long` | `getDuration(TimeUnit unit)` Get the duration of execution time taken.
    `String` | `getId()` Id of this Metrics.
    `String` | `getName()` Name of this Metrics.
    `Collection<ImmutableMetrics>` | `getNested()` Get the nested Metrics objects.
    `ImmutableMetrics` | `getNested(String metricsId)` Get a nested Metrics object by Id.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### id

          protected String id

    - #### name

          protected String name

    - #### counts

          protected Map<String,AtomicLong> counts

    - #### durationNs

          protected long durationNs

    - #### annotations

          protected final Map<String,Object> annotations

    - #### nested

          protected final Map<String,ImmutableMetrics> nested

  - ### Constructor Detail

    - #### ImmutableMetrics

          protected ImmutableMetrics()

  - ### Method Detail

    - #### getDuration

          public long getDuration(TimeUnit unit)

      Description copied from interface: `Metrics`
      Get the duration of execution time taken.
      Specified by:
        `getDuration` in interface `Metrics`

    - #### getCount

          public Long getCount(String key)

      Description copied from interface: `Metrics`
      Get the count for the corresponding countKey. Returns null if countKey does not exist.
      Specified by:
        `getCount` in interface `Metrics`
      Parameters:
        `key` - key for counter to get.

    - #### getCounts

          public Map<String,Long> getCounts()

      Description copied from interface: `Metrics`
      Get the map of all counters. This method copies the internal map.
      Specified by:
        `getCounts` in interface `Metrics`
      Returns:
        a Map where the key is the counter ID and the value is the counter value.

    - #### getName

          public String getName()

      Description copied from interface: `Metrics`
      Name of this Metrics.
      Specified by:
        `getName` in interface `Metrics`
      Returns:
        name of this Metrics.

    - #### getId

          public String getId()

      Description copied from interface: `Metrics`
      Id of this Metrics.
      Specified by:
        `getId` in interface `Metrics`
      Returns:
        id of this Metrics.

    - #### getNested

          public Collection<ImmutableMetrics> getNested()

      Description copied from interface: `Metrics`
      Get the nested Metrics objects. Metrics will be ordered in the order they were inserted.
      Specified by:
        `getNested` in interface `Metrics`
      Returns:
        the nested Metrics objects.

    - #### getNested

          public ImmutableMetrics getNested(String metricsId)

      Description copied from interface: `Metrics`
      Get a nested Metrics object by Id.
      Specified by:
        `getNested` in interface `Metrics`
      Returns:
        a nested Metrics object.

    - #### getAnnotations

          public Map<String,Object> getAnnotations()

      Description copied from interface: `Metrics`
      Obtain the annotations for this Metrics. Values may be of type String or Number.
      Specified by:
        `getAnnotations` in interface `Metrics`
      Returns:
        the annotations for this Metrics. Modifications to the returned object are persisted in the original.

    - #### getAnnotation

          public Object getAnnotation(String key)

      Description copied from interface: `Metrics`
      Obtain the annotation with the specified key. Values may be of type String or Number.
      Specified by:
        `getAnnotation` in interface `Metrics`
      Parameters:
        `key` - key of the annotation to obtain.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2013–2019 Apache Software Foundation. All rights reserved.