Package org.eclipse.mat.inspections.collectionextract

# Class CollectionExtractionUtils

java.lang.Object
org.eclipse.mat.inspections.collectionextract.CollectionExtractionUtils

public class CollectionExtractionUtils extends Object
Utility class providing helpers simplifying the extraction of data from objects in the heap which represent collections

Since:
  1.5

## Constructor Summary

Constructors
Constructor
Description
`CollectionExtractionUtils()`

## Method Summary

Modifier and Type
Method
Description
`static AbstractExtractedCollection<?,?>`
`extractCollection(IObject collection)`
Extracts from the heap the content of objects which represent a collection.
`static AbstractExtractedCollection<?,?>`
`extractCollection(IObject collection, String specificClass, ICollectionExtractor preferredExtractor)`
Extracts from the heap the content of objects which represent a collection.
`static ExtractedCollection`
`extractList(IObject collection)`
Extracts from the heap the content of objects which represent a collection.
`static ExtractedMap`
`extractMap(IObject collection)`
Extracts from the heap the content of objects which represent a Map.
`static ExtractedMap`
`extractMap(IObject collection, String specificClass, IMapExtractor preferredExtractor)`
Extracts from the heap the content of objects which represent a Map.
`static ICollectionExtractor`
`findCollectionExtractor(String className)`
Finds a proper ICollectionExtractor for the object passed as parameter
`static ICollectionExtractor`
`findCollectionExtractor(IObject collection)`
Finds a proper ICollectionExtractor for the object passed as parameter

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

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

## Constructor Details

### CollectionExtractionUtils

public CollectionExtractionUtils()

## Method Details

### findCollectionExtractor

public static ICollectionExtractor findCollectionExtractor(IObject collection) throws SnapshotException
Finds a proper ICollectionExtractor for the object passed as parameter

Parameters:
  `collection` - An IObject representing a collection
Returns:
  ICollectionExtractor an extractor object for the collection
Throws:
  `SnapshotException`

### findCollectionExtractor

public static ICollectionExtractor findCollectionExtractor(String className) throws SnapshotException
Finds a proper ICollectionExtractor for the object passed as parameter

Parameters:
  `className` - the name of a collection class
Returns:
  ICollectionExtractor an extractor object for the collection
Throws:
  `SnapshotException`

### extractCollection

public static AbstractExtractedCollection<?,?> extractCollection(IObject collection) throws SnapshotException
Extracts from the heap the content of objects which represent a collection. The proper extractor is determined internally

Parameters:
  `collection` - an IObject representing a collection for which to extract the contents
Returns:
  AbstractExtractedCollection the extracted contents
Throws:
  `SnapshotException`

### extractCollection

public static AbstractExtractedCollection<?,?> extractCollection(IObject collection, String specificClass, ICollectionExtractor preferredExtractor) throws SnapshotException
Extracts from the heap the content of objects which represent a collection. For objects of class specifiedClass the preferredExtractor will be used, otherwise the extractor is selected internally

Parameters:
  `collection` - an IObject representing a collection for which to extract the contents
  `specificClass` - a class name for which the preferred extractor should be used
  `preferredExtractor` - an extractor object to be used to extract the contents
Returns:
  the extracted contents
Throws:
  `SnapshotException`

### extractList

public static ExtractedCollection extractList(IObject collection) throws SnapshotException
Extracts from the heap the content of objects which represent a collection. The proper extractor is determined internally

Parameters:
  `collection` - an IObject representing a List for which to extract the contents
Returns:
  ExtractedCollection the extracted contents
Throws:
  `SnapshotException`

### extractMap

public static ExtractedMap extractMap(IObject collection) throws SnapshotException
Extracts from the heap the content of objects which represent a Map. The proper extractor is determined internally

Parameters:
  `collection` - an IObject representing a Map for which to extract the contents
Returns:
  ExtractedMap the extracted contents
Throws:
  `SnapshotException`

### extractMap

public static ExtractedMap extractMap(IObject collection, String specificClass, IMapExtractor preferredExtractor) throws SnapshotException
Extracts from the heap the content of objects which represent a Map. For objects of class specifiedClass the preferredExtractor will be used, otherwise the extractor is selected internally

Parameters:
  `collection` - an IObject representing a Map for which to extract the contents
  `specificClass` - a class name for which the preferred extractor should be used
  `preferredExtractor` - an extractor object to be used to extract the contents
Returns:
  ExtractedMap the extracted contents
Throws:
  `SnapshotException`