Package ghidra.app.util.bin.format.golang.structmapping

# Record Class FieldContext<T>

java.lang.Object
java.lang.Record
ghidra.app.util.bin.format.golang.structmapping.FieldContext<T>

Type Parameters:
  `T` - the class that contains this field
Record Components:
  `structureContext` - `StructureContext` that contains this field
  `fieldInfo` - `FieldMappingInfo` immutable information about this field
  `dtc` - `DataTypeComponent` that this field maps to
  `reader` - `BinaryReader` to use when reading data, may be null if this context is for markup operations instead of deserialization

public record FieldContext<T>(StructureContext<T> structureContext, FieldMappingInfo<T> fieldInfo, DataTypeComponent dtc, BinaryReader reader) extends Record
Context of an individual field that is being deserialized, or being markedup.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FieldContext(StructureContext<T> structureContext, FieldMappingInfo<T> fieldInfo, DataTypeComponent dtc, BinaryReader reader)`
  Creates an instance of a `FieldContext` record class.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `DataTypeComponent`
  `dtc()`
  Returns the value of the `dtc` record component.
  `final boolean`
  `equals(Object o)`
  Indicates whether some other object is "equal to" this one.
  `FieldMappingInfo<T>`
  `fieldInfo()`
  Returns the value of the `fieldInfo` record component.
  `Address`
  `getAddress()`
  Returns the address of this structure field.
  `T`
  `getStructureInstance()`
  Returns the structure instance that contains this field.
  `<R> R`
  `getValue(Class<R> expectedType)`
  Returns the value of this java field.
  `final int`
  `hashCode()`
  Returns a hash code value for this object.
  `BinaryReader`
  `reader()`
  Returns the value of the `reader` record component.
  `StructureContext<T>`
  `structureContext()`
  Returns the value of the `structureContext` record component.
  `final String`
  `toString()`
  Returns a string representation of this record class.

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### FieldContext

    public FieldContext(StructureContext<T> structureContext, FieldMappingInfo<T> fieldInfo, DataTypeComponent dtc, BinaryReader reader)
    Creates an instance of a `FieldContext` record class.
    Parameters:
      `structureContext` - the value for the `structureContext` record component
      `fieldInfo` - the value for the `fieldInfo` record component
      `dtc` - the value for the `dtc` record component
      `reader` - the value for the `reader` record component

- ## Method Details

  - ### getStructureInstance

    public T getStructureInstance()
    Returns the structure instance that contains this field.
    Returns:
      structure instance that contains this field

  - ### getAddress

    public Address getAddress()
    Returns the address of this structure field.
    Returns:
      the address of this field

  - ### getValue

    public <R> R getValue(Class<R> expectedType) throws IOException
    Returns the value of this java field.
    Type Parameters:
      `R` - result type
    Parameters:
      `expectedType` - class of expected result type
    Returns:
      value of this java field, as type R
    Throws:
      `IOException` - if error getting or converting value

  - ### toString

    public final String 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.
    Specified by:
      `toString` in class `Record`
    Returns:
      a string representation of this object

  - ### 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.
    Specified by:
      `hashCode` in class `Record`
    Returns:
      a hash code value for this object

  - ### equals

    public final boolean equals(Object o)
    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 `Objects::equals(Object,Object)`.
    Specified by:
      `equals` in class `Record`
    Parameters:
      `o` - the object with which to compare
    Returns:
      `true` if this object is the same as the `o` argument; `false` otherwise.

  - ### structureContext

    public StructureContext<T> structureContext()
    Returns the value of the `structureContext` record component.
    Returns:
      the value of the `structureContext` record component

  - ### fieldInfo

    public FieldMappingInfo<T> fieldInfo()
    Returns the value of the `fieldInfo` record component.
    Returns:
      the value of the `fieldInfo` record component

  - ### dtc

    public DataTypeComponent dtc()
    Returns the value of the `dtc` record component.
    Returns:
      the value of the `dtc` record component

  - ### reader

    public BinaryReader reader()
    Returns the value of the `reader` record component.
    Returns:
      the value of the `reader` record component