Record Class GoVer
java.lang.Object
java.lang.Record
ghidra.app.util.bin.format.golang.GoVer
- Record Components:
major- currently just 1minor- second part of version number, ranges from 0..unknown upper limitpatch- third part of version number, ranges from 0..unknown upper limit per minor version
- All Implemented Interfaces:
Comparable<GoVer>
Represents a Golang version number (major.minor.patch), with some special sentinel values
for wildcarding.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGoVer(int major, int minor, int patch) Creates an instance of aGoVerrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintfinal booleanIndicates whether some other object is "equal to" this one.static GoVerfromProgramProperties(Program program) Parses a version string found in a Ghidra program info properties listintgetMajor()Major valueintgetMinor()Minor valueintgetPatch()Patch valuefinal inthashCode()Returns a hash code value for this object.booleanbooleanintmajor()Returns the value of themajorrecord component.intminor()Returns the value of theminorrecord component.static GoVerParses a version string ("1.2.0") and returns a GoVer instance, or INVALID if bad data.static GoVerParses a version string ("1.2.0") and returns a GoVer instance, or INVALID if bad data.intpatch()Returns the value of thepatchrecord component.static voidWrites a version string to a Ghidra program info properties list.toString()Returns a string representation of this record class.withPatch(int newPatchNum)
-
Field Details
-
GOLANG_VERSION_PROPERTY_NAME
- See Also:
-
INVALID
-
ANY
-
-
Constructor Details
-
Method Details
-
parse
Parses a version string ("1.2.0") and returns a GoVer instance, or INVALID if bad data.Missing patch numbers will be defaulted to 0.
- Parameters:
s- string to parse, "1.2.3", or "1.2"- Returns:
- GoVer instance, or INVALID
-
parseWildcardPatch
Parses a version string ("1.2.0") and returns a GoVer instance, or INVALID if bad data.Missing patch numbers will be replaced with the wildcard value.
- Parameters:
s- string to parse, "1.2.3", or "1.2"- Returns:
- GoVer instance, or INVALID
-
fromProgramProperties
Parses a version string found in a Ghidra program info properties list -
setProgramPropertiesWithOriginalVersionString
Writes a version string to a Ghidra program info properties list.- Parameters:
props- props from a programs- version string
-
isInvalid
public boolean isInvalid() -
isWildcard
public boolean isWildcard() -
getMajor
public int getMajor()Major value- Returns:
- major
-
getMinor
public int getMinor()Minor value- Returns:
- minor
-
getPatch
public int getPatch()Patch value- Returns:
- patch
-
prevPatch
-
withPatch
-
compareTo
- Specified by:
compareToin interfaceComparable<GoVer>
-
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. -
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. -
equals
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 '=='. -
major
public int major()Returns the value of themajorrecord component.- Returns:
- the value of the
majorrecord component
-
minor
public int minor()Returns the value of theminorrecord component.- Returns:
- the value of the
minorrecord component
-
patch
public int patch()Returns the value of thepatchrecord component.- Returns:
- the value of the
patchrecord component
-