# Interface: com.pnfsoftware.jeb.core.units.code.IDecompilerUnit

Generic interface for decompilers.

## Static Field: FLAG_ALLOW_EXTRA_WORK
Type: `int`

Constant value: `256`
Description: Indicate that the decompiler may be allowed to perform extra work; else, its work should be limited to decompiling and only decompiling. If the decompiler implements additional post\-processing tasks that do not relate directly to decompilation, this flag may be set to enable them \(e.g. with dexdec: code matching is an additional post\-processing step\). 

 A decompiler may not be able to honor this flag.

## Static Field: FLAG_BATCH_DECOMPILATION
Type: `int`

Constant value: `32`
Description: This indicative flag is to let the decompiler know that the current decompilation is part of a batch decompilation. This flag may be provided to internal components, that may change their behavior when it is set. 

 A decompiler may ignore this flag.

## Static Field: FLAG_KEEP_IR
Type: `int`

Constant value: `64`
Description: This indicative flag is to let the decompiler know that the intermediate representation shall be kept. 

 A decompiler may not be able to honor this flag.

## Static Field: FLAG_NO_CONCURRENT_DECOMPILATION
Type: `int`

Constant value: `4`
Description: Restrictive flag: if the decompiler supports concurrent decompilations \(multi\-threading\), setting this flag requests it to disable it and perform serial decompilations. 

 A decompiler may choose to ignore this flag.

## Static Field: FLAG_NO_DEFERRED_DECOMPILATION
Type: `int`

Constant value: `2`
Description: Restrictive flag: disallow deferred decompilations. Deferred decompilations are decompilations of additional items, that usually take place after the main request has completed or partially completed, in order to provide better output. 

 A decompiler may choose to ignore this flag.

## Static Field: FLAG_NO_INNER_DECOMPILATION
Type: `int`

Constant value: `1`
Description: Restrictive flag: shallow decompilation \(eg, a request to decompile a method would not decompile inner items contained within the method\). 

 A decompiler may choose to ignore this flag.

## Static Field: FLAG_NO_METHOD_AST_GENERATION
Type: `int`

Constant value: `8`
Description: Special flag indicating that the final stage of a method decompilation \(the generation and optimization of its abstract syntax tree\) shall be skipped. 

 By using this flags, these other flags will be automatically set: [#FLAG_NO_DEFERRED_DECOMPILATION](#FLAG_NO_DEFERRED_DECOMPILATION).
 It is also recommended to use [#FLAG_NO_INNER_DECOMPILATION](#FLAG_NO_INNER_DECOMPILATION) when setting this flag. 

 A decompiler cannot ignore this flag.

## Static Field: FLAG_STANDALONE_IR_CONVERSION
Type: `int`

Constant value: `128`
Description: Indicate that the decompiler should perform a fresh decompilation up to the [NativeDecompilationStage#IR_CONVERSION](NativeDecompilationStage#IR_CONVERSION) stage \(regardless of the provided user\-requested stage\). The decompilation will not be registered with the decompiler. In general, this flag should be combined with [#FLAG_KEEP_IR](#FLAG_KEEP_IR) in order to examine the IR post decompilation. 

 A decompiler may not be able to honor this flag.

## Static Field: FLAG_TEMP_FORCED_REDECOMPILATIONS
Type: `int`

Constant value: `16`
Description: Special flag indicating that already decompiled methods should be temporarily redecompiled. Existing decompilations will not be replaced by new ones. 

 By using this flags, these other flags will be automatically set: [#FLAG_NO_DEFERRED_DECOMPILATION](#FLAG_NO_DEFERRED_DECOMPILATION), [#FLAG_NO_METHOD_AST_GENERATION](#FLAG_NO_METHOD_AST_GENERATION).
 It is also recommended to use [#FLAG_NO_INNER_DECOMPILATION](#FLAG_NO_INNER_DECOMPILATION) when setting this flag. 

 A decompiler cannot ignore this flag.

## Static Field: propnameListOfDisabledExternalPlugins
Type: `java.lang.String`

Constant value: `ListOfDisabledExternalPlugins`
Description: Property name for disabled external plugins.

## Method: canDecompile
- parameter: `identifier`, type: `java.lang.String`
- return type: `boolean`

Description: Determine if a decompilation at the provided identifier/address has a chance to succeed. A positive result may result in a valid decompilation; a negative result will always result in an invalid/impossible decompilation.
parameter: identifier: identifier or address
return: true if decompilation may succeed

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

Description: Determine whether this decompiler can perform decompilations concurrently.
return: true if concurrent decompilations are supported

## Method: decompile
- parameter: `identifiers`, type: `java.util.Collection<java.lang.String>`
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.DecompilationContext`
- return type: `boolean`

Description: Decompile multiple items.
parameter: identifiers: a collection of item identifiers to be decompiled
parameter: ctx: optional context
return: true if and only if all decompilations succeeded

## Method: decompileAll
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.DecompilationContext`
- return type: `boolean`

Description: Decompile everything meaningful.
parameter: ctx: optional context
return: true if and only if all decompilations succeeded

## Method: decompileAllClasses
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.DecompilationContext`
- return type: `boolean`

Description: Decompile all classes. 

 Optional operation.
parameter: ctx: optional context
return: true if and only if all classes were successfully decompiled

## Method: decompileAllMethods
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.DecompilationContext`
- return type: `boolean`

Description: Decompile all methods. 

 Optional operation.
parameter: ctx: optional context
return: true if and only if all methods were successfully decompiled

## Method: decompileClass
- parameter: `identifier`, type: `java.lang.String`
- return type: `boolean`

Description: Decompile a class.
parameter: identifier: class identifier
return: success indicator

## Method: decompileClass
- parameter: `identifier`, type: `java.lang.String`
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.DecompilationContext`
- return type: `boolean`

Description: Decompile a class.
parameter: identifier: class identifier
parameter: ctx: optional context
return: success indicator

## Method: decompileClasses
- parameter: `identifiers`, type: `java.util.Collection<java.lang.String>`
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.DecompilationContext`
- return type: `boolean`

Description: Decompile a collection of classes. 

 Optional operation.
parameter: identifiers: list of class identifiers
parameter: ctx: optional context
return: true if and only if all requested classes were successfully decompiled

## Method: decompileField
- parameter: `identifier`, type: `java.lang.String`
- return type: `boolean`

Description: Decompile a field.
parameter: identifier: field identifier
return: success indicator

## Method: decompileField
- parameter: `identifier`, type: `java.lang.String`
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.DecompilationContext`
- return type: `boolean`

Description: Decompile a field.
parameter: identifier: field identifier
parameter: ctx: optional context
return: success indicator

## Method: decompileMethod
- parameter: `identifier`, type: `java.lang.String`
- return type: `boolean`

Description: Decompile a method.
parameter: identifier: method identifier
return: success indicator

## Method: decompileMethod
- parameter: `identifier`, type: `java.lang.String`
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.DecompilationContext`
- return type: `boolean`

Description: Decompile a method.
parameter: identifier: method identifier
parameter: ctx: optional context
return: success indicator

## Method: decompileMethods
- parameter: `identifiers`, type: `java.util.Collection<java.lang.String>`
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.DecompilationContext`
- return type: `boolean`

Description: Decompile a collection of methods. 

 Optional operation.
parameter: identifiers: list of method identifiers \(methods addresses\)
parameter: ctx: optional context
return: true if and only if all requested methods were successfully decompiled

## Method: decompileToUnit
- parameter: `identifier`, type: `java.lang.String`
- return type: `com.pnfsoftware.jeb.core.units.code.ISourceUnit`

Description: Retrieve a decompiled unit or perform a decompilation. This is a high\-level function used to decompile generate meaningful \(to clients\) decompiled code units. The decompiler may normalize the identifier.
parameter: identifier: the identifier or address at which the decompilation should be performed
return: the source unit

## Method: decompileToUnit
- parameter: `identifier`, type: `java.lang.String`
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.DecompilationContext`
- return type: `com.pnfsoftware.jeb.core.units.code.ISourceUnit`

Description: Retrieve a decompiled unit or perform a decompilation. This is a high\-level function used to decompile and generate meaningful \(to clients\) [source code units](ISourceUnit). The decompiler may normalize the identifier. 

 If a source unit encompassing the provided identifier address already exists, it is returned.
parameter: identifier: the identifier or address at which the decompilation should be performed
parameter: ctx: optional decompilation context and options
return: a source unit, null on error

## Method: getCodeUnit
- return type: `com.pnfsoftware.jeb.core.units.code.ICodeUnit`

Description: Get the code unit \(possibly the parent, possibly null\) that is providing the low\-level data to this decompiler.
return: a code unit, possibly null

## Method: getDecompiledClassText
- parameter: `identifier`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Retrieve the decompiled source for the provided class.
parameter: identifier: class identifier
return: decompiled class text, or null

## Method: getDecompiledFieldText
- parameter: `identifier`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Retrieve the decompiled source for the provided field.
parameter: identifier: field identifier
return: decompiled field text, or null

## Method: getDecompiledMethodText
- parameter: `identifier`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Retrieve the decompiled source for the provided method.
parameter: identifier: method identifier
return: decompiled method text, or null

## Method: getDecompiledText
- parameter: `identifier`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Retrieve the decompiled source for the provided item.
parameter: identifier: object identifier
return: decompiled text, or null

## Method: getDecompiledUnit
- parameter: `identifier`, type: `java.lang.String`
- return type: `com.pnfsoftware.jeb.core.units.code.ISourceUnit`

Description: Retrieve the unit representing the decompiled entity at the provided identifier/address. No decompilation is performed.
parameter: identifier: the identifier or address
return: the unit or null, if no decompilation at the provided identifier previously took         place

## Method: getExporter
- return type: `com.pnfsoftware.jeb.core.units.code.DecompilerExporter`

Description: Convenience method used to create an exporter object used to decompile and export some or all potentially decompilable to source files on disk.
return: exporter object

## Method: getOutputType
- return type: `com.pnfsoftware.jeb.core.units.code.DecompilerOutputType`

Description: Get the type of output produced by this decompiler.
return: the unit \(newly created or retrieved\) or null if no decompilation could be performed

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

Description: Set the maximum number of threads to be used when decompiling multiple items concurrently. 

 Will always return 1 if [#canPerformConcurrentDecompilations()](#canPerformConcurrentDecompilations()) is false.
return: thread pool size

## Method: removeAllDecompilations

Description: Remove all decompilations.

## Method: removeDecompilation
- parameter: `identifier`, type: `java.lang.String`

Description: Remove a decompilation.
parameter: identifier: identifier or address

## Method: removeFreeElements

Description: Remove all decompilation objects that exist but are not directly or indirectly managed by an existing decompiled source unit.

## Method: resetAllDecompilations

Description: Reset all decompilations.

## Method: resetDecompilation
- parameter: `identifier`, type: `java.lang.String`

Description: Reset a decompilation. 

 Note that if a source unit representing the decompiled object exists, it is not guaranteed to be removed. It will simply be reset, making a redecompilation possible. In order to remove a child unit of a decompiler, use [#removeChild(com.pnfsoftware.jeb.core.units.IUnit)](#removeChild(com.pnfsoftware.jeb.core.units.IUnit)). To do a proper removal, use [#removeDecompilation(String)](#removeDecompilation(String)).
parameter: identifier: identifier or address

## Method: runGarbageCollection

Description: This method instructs the decompiler to perform garbage collection. It includes the actions performed by [#removeFreeElements()](#removeFreeElements()).

## Method: setThreadPoolSize
- parameter: `threadPoolSize`, type: `int`

Description: Get the maximum number of threads to be used when decompiling multiple items concurrently. 

 N/A if [#canPerformConcurrentDecompilations()](#canPerformConcurrentDecompilations()) is false.
parameter: threadPoolSize: thread pool size

