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 aGoVer
record class. -
Method Summary
Modifier and TypeMethodDescriptionint
final boolean
Indicates whether some other object is "equal to" this one.static GoVer
fromProgramProperties
(Program program) Parses a version string found in a Ghidra program info properties listint
getMajor()
Major valueint
getMinor()
Minor valueint
getPatch()
Patch valuefinal int
hashCode()
Returns a hash code value for this object.boolean
boolean
int
major()
Returns the value of themajor
record component.int
minor()
Returns the value of theminor
record component.static GoVer
Parses a version string ("1.2.0") and returns a GoVer instance, or INVALID if bad data.static GoVer
Parses a version string ("1.2.0") and returns a GoVer instance, or INVALID if bad data.int
patch()
Returns the value of thepatch
record component.static void
Writes 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:
compareTo
in 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 themajor
record component.- Returns:
- the value of the
major
record component
-
minor
public int minor()Returns the value of theminor
record component.- Returns:
- the value of the
minor
record component
-
patch
public int patch()Returns the value of thepatch
record component.- Returns:
- the value of the
patch
record component
-