# Interface: com.pnfsoftware.jeb.core.units.IUnitProcessor

A unit processor is a parser that uses registered JEB plugins to identify and process input data into [IUnit](IUnit)s. 

 No two identifiers registered in a processor can have the same [type](IUnitIdentifier#getFormatType()). 

 A processor has a PDM and a PM, which are provided to unit identifiers in order to maintain a chain of properties 

 A unit processor is a crucial component for building plugins that achieve high coherence and loose coupling. Please refer to the *JEB Unit Plugin Development Guide: Delegation and Parsing Inner Data* for more information. 

 *Note: may be renamed to IParser*

## Method: createDebugger
- parameter: `name`, type: `java.lang.String`
- parameter: `parent`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- return type: `com.pnfsoftware.jeb.core.units.code.debug.IDebuggerUnit`

Description: Convenience method that processes a code unit to produce an associated debugger unit.
parameter: name: the name of the resulting unit, generally "debugger"
parameter: parent: a prent unit, generally an [ICodeUnit](ICodeUnit)
return: a debugger unit or null

## Method: createDecompiler
- parameter: `name`, type: `java.lang.String`
- parameter: `parent`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- return type: `com.pnfsoftware.jeb.core.units.code.IDecompilerUnit`

Description: Convenience method that processes a code unit to produce an associated decompiler unit.
parameter: name: the name of the resulting unit, generally "decompiler"
parameter: parent: a parent unit, generally an [ICodeUnit](ICodeUnit)
return: a decompiler unit or null

## Method: getAlwaysProcessDuplicateInputs
- return type: `boolean`

Description: Determine whether this parser always process duplicate inputs, or can, under certain conditions, skip processing duplicates.
return: true if duplicate inputs should always be processed

## Method: getDebuggerUnitIdentifiers
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.debug.IDebuggerUnitIdentifier>`

Description: Get a list of unit identifier for debugger units only.
return: a list of debugger unit identifiers

## Method: getProcessingDepth
- return type: `int`

Description: Get the processing depth.
return: the processing depth

## Method: getPropertyDefinitionManager
- return type: `com.pnfsoftware.jeb.core.properties.IPropertyDefinitionManager`

Description: Get the PDM used by this processor.
return: the mandatory PDM

## Method: getPropertyManager
- return type: `com.pnfsoftware.jeb.core.properties.IPropertyManager`

Description: Get the PM used by this processor.
return: the mandatory PM

## Method: getUnitIdentifier
- parameter: `type`, type: `java.lang.String`
- return type: `com.pnfsoftware.jeb.core.units.IUnitIdentifier`

Description: Get an identifier by type.
parameter: type: the unit identifier type string
return: the identifier or null

## Method: getUnitIdentifiers
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.IUnitIdentifier>`

Description: Get a list of unit identifiers managed by this processor.
return: a list of unit identifiers

## Method: process
- parameter: `name`, type: `java.lang.String`
- parameter: `input`, type: `com.pnfsoftware.jeb.core.input.IInput`
- parameter: `parent`, type: `com.pnfsoftware.jeb.core.IUnitCreator`
- parameter: `wantedType`, type: `java.lang.String`
- parameter: `softDelegation`, type: `boolean`
- parameter: `doNotProcessUnit`, type: `boolean`
- return type: `com.pnfsoftware.jeb.core.units.IUnit`

Description: Identify and process input data. The identification part can be short\-circuited by providing a specific wanted type. In that case, the processor looks for a matching identifier, and start processing the input data right away without executing the identification routine.
parameter: name: the optional wanted unit name; if null, a name will be auto\-generated
parameter: input: the optional input binary data
parameter: parent: the creating entity, either a parent unit or an artifact
parameter: wantedType: the optional wanted type. Leave null to let the identifiers perform            identification
parameter: softDelegation: perform soft delegation, aka, avoid calling the unknown resolver \(if            any\) and avoid creating a generic unit if all unit identifiers failed to identify            the input data; in the latter case, this method will return null
parameter: doNotProcessUnit: if true, after preparation by the identifier, do not automatically            call [process\(\)](IUnit#process()) on the newly\-created unit
return: a new unit

## Method: process
- parameter: `name`, type: `java.lang.String`
- parameter: `input`, type: `com.pnfsoftware.jeb.core.input.IInput`
- parameter: `parent`, type: `com.pnfsoftware.jeb.core.IUnitCreator`
- parameter: `wantedType`, type: `java.lang.String`
- parameter: `softDelegation`, type: `boolean`
- return type: `com.pnfsoftware.jeb.core.units.IUnit`

Description: Identify and process input data. 

 Same as: [process\(name, data, parent, wantedType, softDelegation, false\)](#process(String, IInput, IUnitCreator, String, boolean, boolean))
parameter: name: the unit name
parameter: input: the input data
parameter: parent: the parent
parameter: wantedType: the optional wanted type
parameter: softDelegation: true to avoid fallback unknown\-input handling
return: a new unit

## Method: process
- parameter: `name`, type: `java.lang.String`
- parameter: `input`, type: `com.pnfsoftware.jeb.core.input.IInput`
- parameter: `parent`, type: `com.pnfsoftware.jeb.core.IUnitCreator`
- parameter: `wantedType`, type: `java.lang.String`
- return type: `com.pnfsoftware.jeb.core.units.IUnit`

Description: Identify and process input data. 

 Same as: [process\(name, data, parent, wantedType, false, false\)](#process(String, IInput, IUnitCreator, String, boolean, boolean))
parameter: name: the unit name
parameter: input: the input data
parameter: parent: the parent
parameter: wantedType: the optional wanted type
return: a new unit

## Method: process
- parameter: `name`, type: `java.lang.String`
- parameter: `input`, type: `com.pnfsoftware.jeb.core.input.IInput`
- parameter: `parent`, type: `com.pnfsoftware.jeb.core.IUnitCreator`
- return type: `com.pnfsoftware.jeb.core.units.IUnit`

Description: Identify and process input data. 

 Same as: [process\(name, data, parent, null, false, false\)](#process(String, IInput, IUnitCreator, String, boolean, boolean))
parameter: name: the unit name
parameter: input: the input data
parameter: parent: the parent
return: a new unit

## Method: process
- parameter: `name`, type: `java.lang.String`
- parameter: `parent`, type: `com.pnfsoftware.jeb.core.IUnitCreator`
- return type: `com.pnfsoftware.jeb.core.units.IUnit`

Description: Identify and process input data. The input data in that case is the parent unit itself. This method is used when re\-parsing existing units. It is used by decompilers, typically. 

 Same as [process\(name, null, parent, null, false, false\)](#process(String, IInput, IUnitCreator, String, boolean, boolean))
parameter: name: the unit name
parameter: parent: the parent
return: a new unit

## Method: registerPlugin
- parameter: `identifier`, type: `com.pnfsoftware.jeb.core.units.IUnitPlugin`
- return type: `com.pnfsoftware.jeb.core.units.IUnitIdentifier`

Description: Register a plugin: it can be a true unit identifier or a native code plugin \(that will yield an identifier\). 

 This method is used by clients to register unit identifiers manually. The client is responsible for initializing the unit identifier prior to registering it. The client is also responsible for performing appropriate version checking.
parameter: identifier: the plugin to register
return: the newly registered unit identifier

## Method: setProcessingDepth
- parameter: `depth`, type: `int`
- return type: `int`

Description: Set the maximum processing depth. A call to process\(\) can succeed if and only if the depth level of the parent is strictly less than the processing depth. By default, the processing depth is set to 0 \(meaning, process as deep as possible\). Clients may change this setting, temporarily and permanently.
parameter: depth: a number ≥ 1; any number ≤ 0 means no depth \(process as deep as possible\)
return: the previous depth

## Method: setUnknownInputResolver
- parameter: `resolver`, type: `com.pnfsoftware.jeb.core.units.IUnknownInputResolver`

Description: Provide an optional "callback class" used as a last\-resort mechanism when a unit could not be identified. 

 Note: currently, the resolver is not used by the official RCP client
parameter: resolver: an optional resolver

## Method: unregisterUnitIdentifier
- parameter: `identifier`, type: `com.pnfsoftware.jeb.core.units.IUnitIdentifier`
- return type: `boolean`

Description: Unregister a unit identifier.
parameter: identifier: the identifier
return: true if the identifier was unregistered

