# Class CompilationResult

java.lang.Object
com.snmp4j.smi.CompilationResult

All Implemented Interfaces:
  `Serializable`

public class CompilationResult extends Object implements Serializable
The `CompilationResult` class holds the MIB module names successfully parsed for each MIB file or the parsing errors that were detected during compilation.

Author:
  Frank Fock
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CompilationResult(String fileName, List<String> moduleNames, List<SmiError> smiErrorList)`
  Creates new `CompilationResult` from file name, module names, and SMI error list.
  `CompilationResult(String fileName, List<String> moduleNames, List<SmiError> smiErrorList, String zipFileName)`
  Creates new `CompilationResult` from file name, module names, and SMI error list.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static List<String>`
  `getFailedFiles(List<CompilationResult> compilationResults)`
  Gets the file names from the given `CompilationResult`s which had errors during compilation.
  `String`
  `getFileName()`
  Gets the file name (stream name) of the MIB specification.
  `List<String>`
  `getModuleNames()`
  Gets the MIB module names successfully parsed from this MIB specification identified by `getFileName()`.
  `static List<String>`
  `getModuleNames(List<CompilationResult> compilationResults)`
  Get all MIB module names successfully compiled from the given compilation result list.
  `List<SmiError>`
  `getSmiErrorList()`
  Gets a List of `SmiError` instances describing the SMI syntax and semantic errors encountered in the MIB specification identified by `getFileName()`.
  `String`
  `getZipFileName()`
  Returns the file name of the enclosing ZIP file (if present).
  `boolean`
  `hasErrors()`
  Returns `true` if the compilation result contains detected SMI errors.
  `static boolean`
  `hasErrors(List<CompilationResult> compilationResults)`
  Returns `true` if the list of compilation results contains at least one detected SMI error.
  `String`
  `toString()`

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### CompilationResult

    public CompilationResult(String fileName, List<String> moduleNames, List<SmiError> smiErrorList)
    Creates new `CompilationResult` from file name, module names, and SMI error list.
    Parameters:
      `fileName` - the file name of the compiled MIB file.
      `moduleNames` - the MIB module names parsed from the file.
      `smiErrorList` - the SMI errors collected.

  - ### CompilationResult

    public CompilationResult(String fileName, List<String> moduleNames, List<SmiError> smiErrorList, String zipFileName)
    Creates new `CompilationResult` from file name, module names, and SMI error list.
    Parameters:
      `fileName` - the file name of the compiled MIB file.
      `moduleNames` - the MIB moduke names parsed from the file.
      `smiErrorList` - the SMI errors collected.
      `zipFileName` - the file name of the ZIP file containing `fileName`.

- ## Method Details

  - ### getFileName

    public String getFileName()
    Gets the file name (stream name) of the MIB specification.
    Returns:
      a file/stream name.

  - ### getZipFileName

    public String getZipFileName()
    Returns the file name of the enclosing ZIP file (if present).
    Returns:
      the file name (path) of the ZIP file that contains this SMI file or `null` if the compiled file was not part of a ZIP file.
    Since:
      1.4

  - ### getModuleNames

    public List<String> getModuleNames()
    Gets the MIB module names successfully parsed from this MIB specification identified by `getFileName()`.
    Returns:
      a List of MIB module names. If no MIB module names are returned (`null` or empty List) then see the `getSmiErrorList()` for the errors encountered during compilation.

  - ### getSmiErrorList

    public List<SmiError> getSmiErrorList()
    Gets a List of `SmiError` instances describing the SMI syntax and semantic errors encountered in the MIB specification identified by `getFileName()`.
    Returns:
      a List of `SmiError` instances, each describing a SMI syntax or semantic error.

  - ### hasErrors

    public boolean hasErrors()
    Returns `true` if the compilation result contains detected SMI errors.
    Returns:
      `false` if the compilation was successful.
    Since:
      1.4

  - ### hasErrors

    public static boolean hasErrors(List<CompilationResult> compilationResults)
    Returns `true` if the list of compilation results contains at least one detected SMI error.
    Parameters:
      `compilationResults` - a list of compilation results to scan for errors.
    Returns:
      `false` if the compilation was successful.
    Since:
      1.4

  - ### getFailedFiles

    public static List<String> getFailedFiles(List<CompilationResult> compilationResults)
    Gets the file names from the given `CompilationResult`s which had errors during compilation.
    Parameters:
      `compilationResults` - the compilation results.
    Returns:
      the list of failed files (possibly empty).
    Since:
      1.4

  - ### getModuleNames

    public static List<String> getModuleNames(List<CompilationResult> compilationResults)
    Get all MIB module names successfully compiled from the given compilation result list.
    Parameters:
      `compilationResults` - the compilation results from a `SmiManager.compile(NamedInputStream[], CompilationMonitor, SmiCompiler.TargetMode, SmiCompiler.OverwriteMode, SmiCompiler.Strictness)` run.
    Returns:
      a possibly empty list of successfully compiled MIB module names. See also `getModuleNames()`.
    Since:
      1.7.1

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`