Class StructureMappingInfo<T>
java.lang.Object
ghidra.app.util.bin.format.golang.structmapping.StructureMappingInfo<T>
- Type Parameters:
T
- the class that is being mapped into a structure
Contains immutable information about a structure mapped class needed to deserialize
a new object from the data found in a Ghidra program.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
assignContextFieldValues
(StructureContext<T> context) Initializes anyContextField
fields in a new structure instance.createStructureDataType
(StructureContext<T> context) Creates a new customizedstructure data type
for a variable length structure mapped class.static <T> StructureMappingInfo
<T> fromClass
(Class<T> targetClass, Structure structDataType, DataTypeMapperContext context) Returns the mapping info for a class, using annotations found in that class.ghidra.app.util.bin.format.golang.structmapping.StructureMappingInfo.ObjectInstanceCreator
<T> int
void
readStructure
(StructureContext<T> context) Deserializes a structure mapped instance by assigning values to its@FieldMapping mapped
java fields.recoverStructureContext
(T structureInstance) Reaches into a structure mapped instance and extracts its StructureContext field value.
-
Method Details
-
fromClass
public static <T> StructureMappingInfo<T> fromClass(Class<T> targetClass, Structure structDataType, DataTypeMapperContext context) Returns the mapping info for a class, using annotations found in that class.- Type Parameters:
T
- structure mapped class- Parameters:
targetClass
- structure mapped classstructDataType
- GhidraDataType
that defines the binary layout of the mapped fields of the class, or null if this is a self-readingStructureReader
classcontext
-DataTypeMapperContext
- Returns:
- new
StructureMappingInfo
for the specified class - Throws:
IllegalArgumentException
- if targetClass isn't tagged as a structure mapped class
-
getDescription
-
getStructureDataType
-
getStructureName
-
getStructureLength
public int getStructureLength() -
getTargetClass
-
getInstanceCreator
public ghidra.app.util.bin.format.golang.structmapping.StructureMappingInfo.ObjectInstanceCreator<T> getInstanceCreator() -
getFields
-
getAfterMethods
-
readStructure
Deserializes a structure mapped instance by assigning values to its@FieldMapping mapped
java fields.- Parameters:
context
-StructureContext
- Throws:
IOException
- if error reading the structure
-
getMarkupFuncs
-
createStructureDataType
Creates a new customizedstructure data type
for a variable length structure mapped class.- Parameters:
context
-StructureContext
of a variable length structure mapped instance- Returns:
- new
structure data type
with a name that encodes the size information of the variable length fields - Throws:
IOException
- if error creating the Ghidra data type
-
recoverStructureContext
Reaches into a structure mapped instance and extracts its StructureContext field value.- Parameters:
structureInstance
- instance to query- Returns:
StructureContext
, or null if error extracting value
-
assignContextFieldValues
Initializes anyContextField
fields in a new structure instance.- Parameters:
context
-StructureContext
- Throws:
IOException
- if error assigning values to context fields in the structure mapped instance
-