main

square/leakcanary

Last updated at: 29/12/2023 09:38

MetadataExtractor.kt

TLDR

The MetadataExtractor.kt file contains a Kotlin interface called MetadataExtractor which is used to extract metadata from a hprof file. It also includes a companion object with a NO_OP property, which represents a no-operation implementation of the MetadataExtractor interface.

Methods

extractMetadata

This method is defined within the MetadataExtractor interface. It takes a HeapGraph as a parameter and returns a Map<String, String>. The purpose of this method is to extract metadata from the provided HeapGraph.

END

package shark

/**
 * Extracts metadata from a hprof to be reported in [HeapAnalysisSuccess.metadata].
 */
fun interface MetadataExtractor {
  fun extractMetadata(graph: HeapGraph): Map<String, String>

  companion object {

    /**
     * A no-op [MetadataExtractor]
     */
    val NO_OP = MetadataExtractor { emptyMap() }
  }
}