Package db

Class Schema


  • public class Schema
    extends java.lang.Object
    Class for definining the columns in a Ghidra Database table.
    • Constructor Summary

      Constructors 
      Constructor Description
      Schema​(int version, java.lang.Class<? extends Field> keyFieldClass, java.lang.String keyName, java.lang.Class<?>[] fieldClasses, java.lang.String[] fieldNames)
      Construct a new Schema.
      Schema​(int version, java.lang.String keyName, java.lang.Class<?>[] fieldClasses, java.lang.String[] fieldNames)
      Construct a new Schema which uses a long key.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Record createRecord​(long key)
      Create an empty record for the specified key.
      Record createRecord​(Field key)
      Create an empty record for the specified key.
      boolean equals​(java.lang.Object obj)
      Compare two schemas for equality.
      java.lang.Class<?>[] getFieldClasses()
      Get the list of data Field classes for this schema.
      int getFieldCount()
      Get the number of data Fields
      java.lang.String[] getFieldNames()
      Get the list of data Field names for this schema.
      int getFixedLength()
      Get length of fixed-length schema record.
      java.lang.Class<? extends Field> getKeyFieldClass()
      Get the key Field class
      java.lang.String getKeyName()
      Get the key name
      int getVersion()
      Get the schema version.
      boolean isVariableLength()
      Returns true if records for this Schema can be of variable lengths.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Schema

        public Schema​(int version,
                      java.lang.Class<? extends Field> keyFieldClass,
                      java.lang.String keyName,
                      java.lang.Class<?>[] fieldClasses,
                      java.lang.String[] fieldNames)
        Construct a new Schema.
        Parameters:
        version -
        keyFieldClass - Field class associated with primary key. If the class is LongField, the long key methods on Table must be used. Specifying any other Field class requires the use of the Field key methods on Table.
        keyName -
        fieldClasses -
        fieldNames -
      • Schema

        public Schema​(int version,
                      java.lang.String keyName,
                      java.lang.Class<?>[] fieldClasses,
                      java.lang.String[] fieldNames)
        Construct a new Schema which uses a long key. The Field key methods on Table should not be used.
        Parameters:
        version -
        keyName -
        fieldClasses -
        fieldNames -
    • Method Detail

      • getKeyFieldClass

        public java.lang.Class<? extends Field> getKeyFieldClass()
        Get the key Field class
        Returns:
        key Field classes
      • getKeyName

        public java.lang.String getKeyName()
        Get the key name
        Returns:
        key name
      • getFieldClasses

        public java.lang.Class<?>[] getFieldClasses()
        Get the list of data Field classes for this schema. The returned list is ordered consistent with the schema definition.
        Returns:
        data Field classes
      • getFieldNames

        public java.lang.String[] getFieldNames()
        Get the list of data Field names for this schema. The returned list is ordered consistent with the schema definition.
        Returns:
        data Field names
      • getFieldCount

        public int getFieldCount()
        Get the number of data Fields
        Returns:
        data Field count
      • getVersion

        public int getVersion()
        Get the schema version.
        Returns:
        schema version
      • isVariableLength

        public boolean isVariableLength()
        Returns true if records for this Schema can be of variable lengths.
        Returns:
        true if records with this Schema are variable length.
      • getFixedLength

        public int getFixedLength()
        Get length of fixed-length schema record.
        Returns:
        record length or 0 for variable length.
      • createRecord

        public Record createRecord​(long key)
        Create an empty record for the specified key.
        Parameters:
        key -
        Returns:
        Record
      • createRecord

        public Record createRecord​(Field key)
        Create an empty record for the specified key.
        Parameters:
        key -
        Returns:
        new record
      • equals

        public boolean equals​(java.lang.Object obj)
        Compare two schemas for equality. Field names are ignored in this comparison.
        Overrides:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object