Record Class GoModuleInfo

java.lang.Object
java.lang.Record
ghidra.app.util.bin.format.golang.GoModuleInfo
Record Components:
path - module path
version - module version
sum - checksum
replace - replacement module info (may be null)

public record GoModuleInfo(String path, String version, String sum, GoModuleInfo replace) extends Record
Represents information about a single golang module dependency.
  • Constructor Details

    • GoModuleInfo

      public GoModuleInfo(String path, String version, String sum, GoModuleInfo replace)
      Creates an instance of a GoModuleInfo record class.
      Parameters:
      path - the value for the path record component
      version - the value for the version record component
      sum - the value for the sum record component
      replace - the value for the replace record component
  • Method Details

    • fromString

      public static GoModuleInfo fromString(String s, GoModuleInfo replace) throws IOException
      Parses a GoModuleInfo from a formatted string "path[tab]version[tab]checksum".
      Parameters:
      s - string to parse
      replace - GoModuleInfo that is the replacement for this module, or null if no replacement specified
      Returns:
      new GoModuleInfo instance, never null
      Throws:
      IOException - if error parsing string
    • getFormattedString

      public String getFormattedString()
      Returns a formatted version of the information in this instance.
      Returns:
      formatted string
    • asKeyValuePairs

      public Map<String,String> asKeyValuePairs(String prefix)
      Returns the values in this object as elements of a map.
      Parameters:
      prefix - String prefix to put in front of each value name
      Returns:
      map of String → String
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • path

      public String path()
      Returns the value of the path record component.
      Returns:
      the value of the path record component
    • version

      public String version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component
    • sum

      public String sum()
      Returns the value of the sum record component.
      Returns:
      the value of the sum record component
    • replace

      public GoModuleInfo replace()
      Returns the value of the replace record component.
      Returns:
      the value of the replace record component