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 TypeMethodDescriptionvoidassignContextFieldValues(StructureContext<T> context) Initializes anyContextFieldfields in a new structure instance.createStructureDataType(StructureContext<T> context) Creates a new customizedstructure data typefor 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.getFieldInfo(String javaFieldName) ghidra.app.util.bin.format.golang.structmapping.StructureMappingInfo.ObjectInstanceCreator<T> intvoidreadStructure(StructureContext<T> context) Deserializes a structure mapped instance by assigning values to its@FieldMapping mappedjava 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- GhidraDataTypethat defines the binary layout of the mapped fields of the class, or null if this is a self-readingStructureReaderclasscontext-DataTypeMapperContext- Returns:
- new
StructureMappingInfofor 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
-
getFieldInfo
- Throws:
IOException
-
getAfterMethods
-
readStructure
Deserializes a structure mapped instance by assigning values to its@FieldMapping mappedjava fields.- Parameters:
context-StructureContext- Throws:
IOException- if error reading the structure
-
getMarkupFuncs
-
createStructureDataType
Creates a new customizedstructure data typefor a variable length structure mapped class.- Parameters:
context-StructureContextof a variable length structure mapped instance- Returns:
- new
structure data typewith 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 anyContextFieldfields in a new structure instance.- Parameters:
context-StructureContext- Throws:
IOException- if error assigning values to context fields in the structure mapped instance
-