# Class: com.pnfsoftware.jeb.core.units.UnitUtil

Utility methods for [units](IUnit).

## Constructor: UnitUtil


## Static Method: buildFullyQualifiedCandidateUnitPath
- parameter: `candidateUnitName`, type: `java.lang.String`
- parameter: `parent`, type: `com.pnfsoftware.jeb.core.IUnitCreator`
- parameter: `includeArtifact`, type: `boolean`
- parameter: `separator`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Build the fully\-qualified path of a potential unit whose only the name is provided.
parameter: candidateUnitName: 
parameter: parent: 
parameter: includeArtifact: 
parameter: separator: 
return: 

## Static Method: buildFullyQualifiedUnitPath
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `includeArtifact`, type: `boolean`
- parameter: `separator`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Build a fully\-qualified unit path.
parameter: unit: 
parameter: includeArtifact: 
parameter: separator: 
return: 

## Static Method: buildFullyQualifiedUnitPath
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- return type: `java.lang.String`

Description: Build a unit path of the artifact name and its parent units, such as:`artifact > unit > unit > ... > unit`
parameter: unit: 
return: 

## Static Method: buildFullyQualifiedUnitPathList
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.IUnitCreator`
- parameter: `includeArtifact`, type: `boolean`
- return type: `java.util.List<java.lang.String>`

Description: Build a fully\-qualified unit path as list of unit names.
parameter: unit: 
parameter: includeArtifact: 
return: 

## Static Method: debuggerProperty
- parameter: `engctx`, type: `com.pnfsoftware.jeb.core.IEnginesContext`
- parameter: `codeType`, type: `java.lang.String`
- parameter: `propertyName`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Generate a fully\-qualified property name used by a [decompiler unit](IDecompilerUnit).
parameter: engctx: JEB engines context
parameter: codeType: code unit type \(not a debugger unit\)
parameter: propertyName: simple property name
return: 

## Static Method: decompilerProperty
- parameter: `engctx`, type: `com.pnfsoftware.jeb.core.IEnginesContext`
- parameter: `codeType`, type: `java.lang.String`
- parameter: `propertyName`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Generate a fully\-qualified property name used by a [decompiler unit](IDecompilerUnit).
parameter: engctx: JEB engines context
parameter: codeType: code unit type \(not a decompiler unit\)
parameter: propertyName: simple property name
return: 

## Static Method: filterDescendants
- parameter: `base`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `maxDepth`, type: `int`
- parameter: `filter`, type: `com.pnfsoftware.jeb.core.IUnitFilter`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.IUnit>`

Description: Retrieve a list of descendants of the provided unit that pass the provided filter test and do not exceeded the maximum depth.
parameter: base: 
parameter: maxDepth: use \-1 to go as deep as possible
parameter: filter: 
return: 

## Static Method: findAll
- parameter: `name`, type: `java.lang.String`
- parameter: `c`, type: `java.lang.Class<T>`
- parameter: `strict`, type: `boolean`
- return type: `java.util.List<T>`


## Static Method: findAncestor
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `c`, type: `java.lang.Class<T>`
- parameter: `strict`, type: `boolean`
- return type: `T`

Description: Find the closest ancestor of an [IUnit](IUnit) that matches a [Class](Class).
parameter: unit: a children element
parameter: c: the class to match. Can be an interface.
parameter: strict: if true, only units of the exact classtype will be returned
return: the closest ancestor that matches, or null if not found

## Static Method: findChild
- parameter: `base`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `name`, type: `java.lang.String`
- parameter: `c`, type: `java.lang.Class<T>`
- parameter: `strict`, type: `boolean`
- parameter: `index`, type: `int`
- return type: `T`


## Static Method: findChildByFormatType
- parameter: `base`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `formatType`, type: `java.lang.String`
- parameter: `index`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.IUnit`


## Static Method: findChildByName
- parameter: `base`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `name`, type: `java.lang.String`
- parameter: `index`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.IUnit`


## Static Method: findChildByType
- parameter: `base`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `classtype`, type: `java.lang.Class<T>`
- parameter: `exactClasstype`, type: `boolean`
- parameter: `index`, type: `int`
- return type: `T`


## Static Method: findChildren
- parameter: `base`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `name`, type: `java.lang.String`
- parameter: `c`, type: `java.lang.Class<T>`
- parameter: `strict`, type: `boolean`
- return type: `java.util.List<T>`


## Static Method: findChildrenByFormatType
- parameter: `base`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `formatType`, type: `java.lang.String`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.IUnit>`


## Static Method: findChildrenByName
- parameter: `base`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `name`, type: `java.lang.String`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.IUnit>`


## Static Method: findChildrenByType
- parameter: `base`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `classtype`, type: `java.lang.Class<T>`
- parameter: `exactClasstype`, type: `boolean`
- return type: `java.util.List<T>`


## Static Method: findDescendants
- parameter: `base`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `maxDepth`, type: `int`
- parameter: `name`, type: `java.lang.String`
- parameter: `classtype`, type: `java.lang.Class<T>`
- parameter: `exactClasstype`, type: `boolean`
- return type: `java.util.List<T>`

Description: Convenience function to find descendant units by type and/or name.
parameter: base: 
parameter: maxDepth: use \-1 to go as deep as possible
parameter: name: optional
parameter: classtype: optional
parameter: exactClasstype: 
return: 

## Static Method: findDescendants
- parameter: `base`, type: `com.pnfsoftware.jeb.core.ILiveArtifact`
- parameter: `level`, type: `int`
- parameter: `name`, type: `java.lang.String`
- parameter: `c`, type: `java.lang.Class<T>`
- parameter: `strict`, type: `boolean`
- return type: `java.util.List<T>`


## Static Method: findDescendantsByFormatType
- parameter: `base`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `level`, type: `int`
- parameter: `formatType`, type: `java.lang.String`
- return type: `java.util.List<T>`


## Static Method: findDescendantsByFormatType
- parameter: `base`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `formatType`, type: `java.lang.String`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.IUnit>`


## Static Method: findDescendantsByName
- parameter: `base`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `maxDepth`, type: `int`
- parameter: `name`, type: `java.lang.String`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.IUnit>`

Description: Retrieve a list of descendant units of the provided unit that have the provided name.
parameter: base: 
parameter: maxDepth: use \-1 to go as deep as possible
parameter: name: 
return: 

## Static Method: findDescendantsByName
- parameter: `base`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `name`, type: `java.lang.String`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.IUnit>`


## Static Method: findDescendantsByType
- parameter: `base`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `maxDepth`, type: `int`
- parameter: `classtype`, type: `java.lang.Class<T>`
- parameter: `exactClasstype`, type: `boolean`
- return type: `java.util.List<T>`

Description: Retrieve a list of descendant units of the provided unit that are of the provided classtype \(exact or derived\) and do not exceeded the maximum depth.
parameter: base: 
parameter: maxDepth: use \-1 to go as deep as possible
parameter: classtype: wanted classtype
parameter: exactClasstype: if true, only units of the exact classtype will be returned
return: 

## Static Method: findDescendantsByType
- parameter: `base`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `classtype`, type: `java.lang.Class<T>`
- parameter: `exactClasstype`, type: `boolean`
- return type: `java.util.List<T>`


## Static Method: findFirstChildByFormatType
- parameter: `base`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `formatType`, type: `java.lang.String`
- return type: `com.pnfsoftware.jeb.core.units.IUnit`


## Static Method: findFirstChildByName
- parameter: `base`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `name`, type: `java.lang.String`
- return type: `com.pnfsoftware.jeb.core.units.IUnit`


## Static Method: findFirstChildByType
- parameter: `base`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `classtype`, type: `java.lang.Class<T>`
- parameter: `exactClasstype`, type: `boolean`
- return type: `T`


## Static Method: getUnitsFromPathList
- parameter: `prj`, type: `com.pnfsoftware.jeb.core.IRuntimeProject`
- parameter: `path`, type: `java.util.List<java.lang.String>`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.IUnit>`

Description: Retrieve the targets [IUnit](IUnit) from its path \(built from [#buildFullyQualifiedUnitPathList(IUnitCreator, boolean)](#buildFullyQualifiedUnitPathList(IUnitCreator, boolean)) for example\). Note that result target will be unique in most of the cases.
parameter: prj: 
parameter: path: 
return: 

## Static Method: isAncestorOf
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `expectedAncestor`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- return type: `boolean`


## Static Method: isAncestorOf
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `expectedAncestor`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `strictAncestor`, type: `boolean`
- return type: `boolean`


## Static Method: isTopLevelUnit
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- return type: `boolean`

Description: 
parameter: unit: 
return: 

## Static Method: logError
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `address`, type: `java.lang.String`
- parameter: `recordNotification`, type: `boolean`
- parameter: `logger`, type: `com.pnfsoftware.jeb.util.logging.ILogger`
- parameter: `format`, type: `java.lang.String`
- parameter: `params`, type: `java.lang.Object[]`

Description: Log an error and optionally record a unit notification.
parameter: unit: 
parameter: address: 
parameter: recordNotification: 
parameter: logger: 
parameter: format: 
parameter: params: 

## Static Method: logException
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `logger`, type: `com.pnfsoftware.jeb.util.logging.ILogger`
- parameter: `e`, type: `java.lang.Exception`

Description: Log an exception and optionally record a unit notification.
parameter: unit: 
parameter: logger: 
parameter: e: 

## Static Method: logI
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `address`, type: `java.lang.String`
- parameter: `logger`, type: `com.pnfsoftware.jeb.util.logging.ILogger`
- parameter: `format`, type: `java.lang.String`
- parameter: `params`, type: `java.lang.Object[]`

Description: Log an internal message.
parameter: unit: 
parameter: address: 
parameter: logger: 
parameter: format: 
parameter: params: 

## Static Method: logInfo
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `address`, type: `java.lang.String`
- parameter: `recordNotification`, type: `boolean`
- parameter: `logger`, type: `com.pnfsoftware.jeb.util.logging.ILogger`
- parameter: `format`, type: `java.lang.String`
- parameter: `params`, type: `java.lang.Object[]`

Description: Log an informational message and optionally record a unit notification.
parameter: unit: 
parameter: address: 
parameter: recordNotification: 
parameter: logger: 
parameter: format: 
parameter: params: 

## Static Method: logTrace
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `address`, type: `java.lang.String`
- parameter: `logger`, type: `com.pnfsoftware.jeb.util.logging.ILogger`
- parameter: `format`, type: `java.lang.String`
- parameter: `params`, type: `java.lang.Object[]`

Description: Log a trace message.
parameter: unit: 
parameter: address: 
parameter: logger: 
parameter: format: 
parameter: params: 

## Static Method: logWarn
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `address`, type: `java.lang.String`
- parameter: `recordNotification`, type: `boolean`
- parameter: `logger`, type: `com.pnfsoftware.jeb.util.logging.ILogger`
- parameter: `format`, type: `java.lang.String`
- parameter: `params`, type: `java.lang.Object[]`

Description: Log a warning and optionally record a unit notification.
parameter: unit: 
parameter: address: 
parameter: recordNotification: 
parameter: logger: 
parameter: format: 
parameter: params: 

## Static Method: notifyGenericChange
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.IUnit`

Description: Issue a generic [J#UnitChange](J#UnitChange) event to all listeners of the provided unit.
parameter: unit: a unit

## Static Method: retrieve
- parameter: `base`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `pathElements`, type: `java.lang.String[]`
- return type: `com.pnfsoftware.jeb.core.units.IUnit`

Description: Retrieve a unit rooted in the provided base, and whose relative path from that base consists of the provided path elements.
parameter: base: a root unit
parameter: pathElements: 1 or more sub\-unit names
return: the unit corresponding to the last path element, null if not found \- the unit may not         have been processed

## Static Method: retrieveProcessed
- parameter: `processIfUnprocessed`, type: `boolean`
- parameter: `base`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `pathElements`, type: `java.lang.String[]`
- return type: `com.pnfsoftware.jeb.core.units.IUnit`

Description: Retrieve a unit rooted in the provided base, and whose relative path from that base consists of the provided path elements. The returned unit is guaranteed to be processed.
parameter: processIfUnprocessed: attempt to process the unit if it is unprocessed
parameter: base: 
parameter: pathElements: 
return: a unit \(processed\) or null

## Static Method: unitProperty
- parameter: `ident`, type: `com.pnfsoftware.jeb.core.units.IUnitIdentifier`
- parameter: `propertyName`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Generate a fully\-qualified property name used by a [unit](IUnit).
parameter: ident: a unit identifier
parameter: propertyName: simple property name
return: a FQ name

## Static Method: unitProperty
- parameter: `unit`, type: `com.pnfsoftware.jeb.core.units.IUnit`
- parameter: `propertyName`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Generate a fully\-qualified property name used by a [unit](IUnit).
parameter: unit: a unit
parameter: propertyName: simple property name
return: a FQ name

## Static Method: unitProperty
- parameter: `engctx`, type: `com.pnfsoftware.jeb.core.IEnginesContext`
- parameter: `unitType`, type: `java.lang.String`
- parameter: `propertyName`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Generate a fully\-qualified property name used by a [unit](IUnit).
parameter: engctx: JEB engines context
parameter: unitType: unit type
parameter: propertyName: simple property name
return: a FQ name

