Package ghidra.util.database

# Class SchemaBuilder

java.lang.Object
ghidra.util.database.SchemaBuilder

public class SchemaBuilder extends Object
A builder for `Schema`

Provides a more fluent syntax for creating table schemas. For example:

     new Schema(1, StringField.class, "UUID",
            new Class[] { StringField.class, IntField.class }, new String[] { "Name", "Flags" },
            new int[] { 1 });

Can be expressed using the builder:

     new SchemaBuilder().keyField("UUID", StringField.class)
                    .field("Name", StringField.class)
                    .field("Flags", IntField.class, true)
                    .build();

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SchemaBuilder()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Schema`
  `build()`
  `SchemaBuilder`
  `field(String name, Class<? extends Field> cls)`
  `SchemaBuilder`
  `field(String name, Class<? extends Field> cls, boolean sparse)`
  `int`
  `fieldCount()`
  `static int`
  `getColumnIndex(Schema schema, String name)`
  `SchemaBuilder`
  `keyField(String name, Class<? extends Field> cls)`
  `static int[]`
  `toIntArray(List<Integer> list)`
  `SchemaBuilder`
  `version(int version)`

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

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### SchemaBuilder

    public SchemaBuilder()

- ## Method Details

  - ### toIntArray

    public static int[] toIntArray(List<Integer> list)

  - ### getColumnIndex

    public static int getColumnIndex(Schema schema, String name)

  - ### version

    public SchemaBuilder version(int version)

  - ### keyField

    public SchemaBuilder keyField(String name, Class<? extends Field> cls)

  - ### field

    public SchemaBuilder field(String name, Class<? extends Field> cls, boolean sparse)

  - ### field

    public SchemaBuilder field(String name, Class<? extends Field> cls)

  - ### fieldCount

    public int fieldCount()

  - ### build

    public Schema build()