org.apache.lucene.util

## Class Accountables

- java.lang.Object
- - org.apache.lucene.util.Accountables

-     public class Accountables
      extends Object

  Helper methods for constructing nested resource descriptions and debugging RAM usage.

  `toString(Accountable`} can be used to quickly debug the nested structure of any Accountable.

  The `namedAccountable` and `namedAccountables` methods return type-safe, point-in-time snapshots of the provided resources.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Accountable` | `namedAccountable(String description, Accountable in)` Augments an existing accountable with the provided description.
    `static Accountable` | `namedAccountable(String description, Collection<Accountable> children, long bytes)` Returns an accountable with the provided description, children and bytes.
    `static Accountable` | `namedAccountable(String description, long bytes)` Returns an accountable with the provided description and bytes.
    `static Collection<Accountable>` | `namedAccountables(String prefix, Map<?,? extends Accountable> in)` Converts a map of resources to a collection.
    `static String` | `toString(Accountable a)` Returns a String description of an Accountable and any nested resources.

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

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

- - ### Method Detail

    - #### toString

          public static String toString(Accountable a)

      Returns a String description of an Accountable and any nested resources. This is intended for development and debugging.

    - #### namedAccountable

          public static Accountable namedAccountable(String description,
                                     Accountable in)

      Augments an existing accountable with the provided description.

      The resource description is constructed in this format: `description [toString()]`

      This is a point-in-time type safe view: consumers will not be able to cast or manipulate the resource in any way.

    - #### namedAccountable

          public static Accountable namedAccountable(String description,
                                     long bytes)

      Returns an accountable with the provided description and bytes.

    - #### namedAccountables

          public static Collection<Accountable> namedAccountables(String prefix,
                                                  Map<?,? extends Accountable> in)

      Converts a map of resources to a collection.

      The resource descriptions are constructed in this format: `prefix 'key' [toString()]`

      This is a point-in-time type safe view: consumers will not be able to cast or manipulate the resources in any way.

    - #### namedAccountable

          public static Accountable namedAccountable(String description,
                                     Collection<Accountable> children,
                                     long bytes)

      Returns an accountable with the provided description, children and bytes.

      The resource descriptions are constructed in this format: `description [toString()]`

      This is a point-in-time type safe view: consumers will not be able to cast or manipulate the resources in any way, provided that the passed in children Accountables (and all their descendants) were created with one of the namedAccountable functions.

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.