Package db
Class Schema
- java.lang.Object
-
- db.Schema
-
public class Schema extends java.lang.ObjectClass 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 RecordcreateRecord(long key)Create an empty record for the specified key.RecordcreateRecord(Field key)Create an empty record for the specified key.booleanequals(java.lang.Object obj)Compare two schemas for equality.java.lang.Class<?>[]getFieldClasses()Get the list of data Field classes for this schema.intgetFieldCount()Get the number of data Fieldsjava.lang.String[]getFieldNames()Get the list of data Field names for this schema.intgetFixedLength()Get length of fixed-length schema record.java.lang.Class<? extends Field>getKeyFieldClass()Get the key Field classjava.lang.StringgetKeyName()Get the key nameintgetVersion()Get the schema version.booleanisVariableLength()Returns true if records for this Schema can be of variable lengths.java.lang.StringtoString()
-
-
-
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:
equalsin classjava.lang.Object- See Also:
Object.equals(java.lang.Object)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-