Annotation Interface FieldMapping
If the name of the java field does not match the Ghidra structure field name, the
fieldName()
property can be used to manually specify the Ghidra field name.
The type of the tagged java field can be a java primitive, or a
structure mapped
class.
Supported java primitive types:
- long, int, short, byte
- char
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionString[]
Overrides the field name that is matched in the structure.int
Allows override the length of the structure fieldboolean
Marks this field as optional.Marks this field as only present in certain context configurations.Class
<? extends FieldReadFunction> Optional function that will deserialize the tagged field.Specifies the name of a setter method that will be used to assign the deserialized value to the java field.Override the signedness of the underlying numeric field.
-
Element Details
-
fieldName
String[] fieldNameOverrides the field name that is matched in the structure.Can be a single name, or a list of names that will be used to find the structure field. The name is case-insensitive.
- Returns:
- name, or list of names (case insensitive), of the structure field to map, or unset to use the java field's name
- Default:
{""}
-
optional
boolean optionalMarks this field as optional.When marked optional, if a binding between the tagged java field and a structure field is not successfully found, this field definition will be skipped.
- Returns:
- boolean flag, if true this field is optional, if false or unset, the field is required
- Default:
false
-
presentWhen
String presentWhenMarks this field as only present in certain context configurations.The specified string is interpreted by the specific
DataTypeMapper
and itscontext
.For example, a version number could be used to allow some optional fields to be skipped depending on the the concrete
DataTypeMapper
's information during structure mapping registration.Similar to
optional()
- Returns:
- String
- Default:
""
-
setter
String setterSpecifies the name of a setter method that will be used to assign the deserialized value to the java field.If unset, a "void setFieldname(field_type)" method will be searched for.
If no setter method is present, the field's value will be directly assigned.
- Returns:
- optional name of a setter method
- Default:
""
-
readFunc
Class<? extends FieldReadFunction> readFuncOptional function that will deserialize the tagged field.- Returns:
FieldReadFunction
- Default:
ghidra.app.util.bin.format.golang.structmapping.FieldReadFunction.class
-
length
int lengthAllows override the length of the structure field- Returns:
- length of the structure field, or unset to use the field's data type
- Default:
-1
-
signedness
Signedness signednessOverride the signedness of the underlying numeric field.- Returns:
Signedness
enum, or unset to use the data type's normal signedness
- Default:
Unspecified
-