Class TileDatabase

java.lang.Object
nz.ac.vuw.ecs.swen225.gp22.domain.TileDatabase

public class TileDatabase extends Object
Used by persistency module to create tiles based on an ID (for loading), as well as get the ID of a current object (for saving).
Author:
Abdul
  • Constructor Details

    • TileDatabase

      public TileDatabase()
  • Method Details

    • create

      public static Tile create(String tileID, Object... tileParams)
      Factory method that creates a Tile object based on the tile ID. Makes sure the given parameters are the correct amount and with the correct types. Suppresses unchecked warnings because I know that any constructor from a class in tileDB will be of the correct constructor type.
      Parameters:
      tileID - ID of the requested tile.
      tileParams - Array of the given tile parameters.
      Returns:
      The newly created tile Tile.
    • getID

      public static String getID(Class<? extends Tile> clazz)
      Gets the ID of a tile class.
      Parameters:
      clazz - Class to get ID of.
      Returns:
      String ID of the class
    • getID

      public static String getID(Tile tile)
      Overloaded method for getID() with Tile object as the parameter.
      Parameters:
      tile - Tile object to get ID of.
      Returns:
      String ID of the object's class.