Package org.eclipse.m2m.atl.core.emf

## Class EMFExtractor

- java.lang.Object
- - org.eclipse.m2m.atl.core.emf.EMFExtractor

All Implemented Interfaces:
  `IExtractor`

    public class EMFExtractor
    extends java.lang.Object
    implements IExtractor

The EMF implementation of the `IExtractor` interface.

### Constructor Summary

Constructors
`EMFExtractor()`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `extract​(EMFModel sourceModel, java.io.OutputStream target, java.lang.String fileExtension, java.util.Map<java.lang.String,​java.lang.Object> options)` Extracts an `EMFModel` to an `OutputStream`.
`void` `extract​(IModel sourceModel, java.io.OutputStream target, java.util.Map<java.lang.String,​java.lang.Object> options)` Extracts an IModel using the given options.
`void` `extract​(IModel sourceModel, java.lang.String target)` Extracts an IModel using default options.
`void` `extract​(IModel sourceModel, java.lang.String target, java.util.Map<java.lang.String,​java.lang.Object> options)` Extracts an IModel using the given options.
`protected static void` `recreateResourceIfNeeded​(EMFModel model, org.eclipse.emf.common.util.URI uri, java.lang.String contentType, boolean contentTypeLookup)` Recreates the resource in order to save in the correct format matching the file extension.

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

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

### Constructor Detail

#### EMFExtractor

    public EMFExtractor()

### Method Detail

#### extract

    public void extract​(IModel sourceModel,
                        java.lang.String target,
                        java.util.Map<java.lang.String,​java.lang.Object> options)
                 throws ATLCoreException

Extracts an IModel using the given options. Below the target parameter semantic.

- File system Resource: `file:/path`
- Workspace Resource: `platform:/resource/path`

Specified by:
  `extract` in interface `IExtractor`
Parameters:
  `sourceModel` - the IModel to extract
  `target` - the target indication to extract the targetModel
  `options` - the extraction parameters
Throws:
  `ATLCoreException`
See Also:
  `IExtractor.extract(org.eclipse.m2m.atl.core.IModel, java.lang.String, java.util.Map)`

#### extract

    public void extract​(IModel sourceModel,
                        java.lang.String target)
                 throws ATLCoreException

Extracts an IModel using default options.

Specified by:
  `extract` in interface `IExtractor`
Parameters:
  `sourceModel` - the IModel to extract
  `target` - the target indication to extract the targetModel
Throws:
  `ATLCoreException`
See Also:
  `IExtractor.extract(org.eclipse.m2m.atl.core.IModel, java.lang.String)`

#### extract

    public void extract​(EMFModel sourceModel,
                        java.io.OutputStream target,
                        java.lang.String fileExtension,
                        java.util.Map<java.lang.String,​java.lang.Object> options)
                 throws ATLCoreException

Extracts an `EMFModel` to an `OutputStream`.

Parameters:
  `sourceModel` - the `EMFModel` to extract
  `target` - the target `OutputStream` to extract the targetModel
  `fileExtension` - the target file extension: defines the output format, default "xmi"
  `options` - the extraction parameters
Throws:
  `ATLCoreException`

#### extract

    public void extract​(IModel sourceModel,
                        java.io.OutputStream target,
                        java.util.Map<java.lang.String,​java.lang.Object> options)
                 throws ATLCoreException

Extracts an IModel using the given options.

Specified by:
  `extract` in interface `IExtractor`
Parameters:
  `sourceModel` - the IModel to extract
  `target` - the `OutputStream` where to extract the targetModel
  `options` - the extraction parameters
Throws:
  `ATLCoreException`
See Also:
  `IExtractor.extract(org.eclipse.m2m.atl.core.IModel, java.io.OutputStream, java.util.Map)`

#### recreateResourceIfNeeded

    protected static void recreateResourceIfNeeded​(EMFModel model,
                                                   org.eclipse.emf.common.util.URI uri,
                                                   java.lang.String contentType,
                                                   boolean contentTypeLookup)
                                            throws ATLCoreException

Recreates the resource in order to save in the correct format matching the file extension.

Parameters:
  `model` - the model to recreate
  `uri` - the target `URI` with the correct extension
  `contentType` - the content type of the resource to save
  `contentTypeLookup` - specify whether the Extractor should automatically resolve the EPackage content type
Throws:
  `ATLCoreException`