Class DiscoverableTableUtils


  • public class DiscoverableTableUtils
    extends java.lang.Object
    • Constructor Detail

      • DiscoverableTableUtils

        public DiscoverableTableUtils()
    • Method Detail

      • adaptColumForModel

        public static <ROW_TYPE,​COLUMN_TYPE,​DATA_SOURCE> DynamicTableColumn<ROW_TYPE,​COLUMN_TYPE,​DATA_SOURCE> adaptColumForModel​(GDynamicColumnTableModel<ROW_TYPE,​COLUMN_TYPE> model,
                                                                                                                                                         AbstractDynamicTableColumn<?,​?,​?> column)
        Returns a column object that is usable by the given model.

        Dynamic columns and models work on row types. This method allows clients to use columns with row types that differ from the model's row type, as long as a suitable mapper can be found. If no mapper can be found, then an IllegalArgumentException is thrown. Also, if the given column is of the correct type, then that column is returned.

        Type Parameters:
        ROW_TYPE - the model's row type
        COLUMN_TYPE - the model's row type
        Parameters:
        model - the table model for which a column is needed
        column - the column that you want to use with the given model
        Returns:
        a column object that is usable by the given model.
        Throws:
        java.lang.IllegalArgumentException - if this method cannot figure out how to map the given column's row type to the given model's row type.
      • getDynamicTableColumns

        public static <ROW_TYPE> java.util.Collection<DynamicTableColumn<ROW_TYPE,​?,​?>> getDynamicTableColumns​(java.lang.Class<ROW_TYPE> rowTypeClass)
        Returns all "discovered" AbstractDynamicTableColumn classes that are compatible with the given class, which represents the object for a table's row. For example, many tables use Address as the row type. In this case, passing Address.class as the parameter to this method will return all AbstractDynamicTableColumns that can provide column data by working with Address instances.

        Usage Notes: This class will not only discover AbstractDynamicTableColumns that directly support the given class type, but will also use discovered TableRowMapper objects to create adapters that allow the use of table row data that does not exactly match the supported type of discovered AbstractDynamicTableColumn classes. For example, suppose that a table's row type is Address. This methods will return at least all AbstractDynamicTableColumns that support Address data. In order to support extra columns, Ghidra has created a TableRowMapper that can convert a ProgramLocation into an Address. This method will find and use this mapper to return a MappedTableColumn instance (which is an AbstractDynamicTableColumn). By doing this, any table that has Address objects as its row type can now use AbstractDynamicTableColumns that support ProgramLocations in addition to Address objects. These mappers provide a way for tables that have non-standard Ghidra data as their row type to take advantage of existing dynamic columns for standard Ghidra data (like ProgramLocations and Addresses).

        Parameters:
        rowTypeClass - table's row type
        Returns:
        the discovered column
      • getColumnConstraints

        public static <T,​M> java.util.Collection<ColumnConstraint<T>> getColumnConstraints​(ColumnTypeMapper<T,​M> mapper)
        Returns a list of all the ColumnConstraint that are capable of filtering the destination type of the given mapper. The mapper will be used to create a mapped constraint that will be called with an instance of the type T.
        Parameters:
        mapper - the mapper that will be used to convert
        Returns:
        a list of all the ColumnConstraint that are capable of filtering the given column type
      • getColumnConstraints

        public static <T> java.util.Collection<ColumnConstraint<T>> getColumnConstraints​(java.lang.Class<T> columnType)
        Returns a list of all the ColumnConstraint that are capable of filtering the given column type.
        Parameters:
        columnType - the class of the data that is return by the table model for specific column.
        Returns:
        a list of all the ColumnConstraint that are capable of filtering the given column type.