Annotation Interface FieldMapping


@Retention(RUNTIME) @Target(FIELD) public @interface FieldMapping
Indicates that the tagged java field corresponds to a field in a Ghidra structure.

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

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Overrides the field name that is matched in the structure.
    int
    Allows override the length of the structure field
    boolean
    Marks this field as optional.
    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[] fieldName
      Overrides 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 optional
      Marks 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
    • setter

      String setter
      Specifies 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> readFunc
      Optional function that will deserialize the tagged field.
      Returns:
      FieldReadFunction
      Default:
      ghidra.app.util.bin.format.golang.structmapping.FieldReadFunction.class
    • length

      int length
      Allows 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 signedness
      Override the signedness of the underlying numeric field.
      Returns:
      Signedness enum, or unset to use the data type's normal signedness
      Default:
      Unspecified