read method

void read(
  1. AccessReader reader,
  2. Map data,
  3. Iterable<String>? fields
)

Reads the given JSON object into the data members of this entity. *

  • Application rarely needs to invoke this method.
  • It is used by the plugin to initialize an entity (instantiated by
  • Entity.be).
  • Default: does nothing (no fields are parsed and read).
  • The deriving class must override this method to read all data member
  • stored in write. For example,
  • void read(AccessReader reader, Map data, Iterable<String> fields) {
    
  •   super.read(reader, data, fields);
    
  •   someData = data["someData"];
    
  •   someEntity = reader.entity(SomeType, data["someEntity"]);
    
  •   someDateTime = reader.dateTime(data["someDateTime"]);
    
  • }
    
  • As shown, you can use utilities in reader to convert Entity
  • and DateTime.
    • fields - the fields being loaded. If null, it means all fields.
  • In general, you can ignore this argument (but use data instead).

Implementation

void read(AccessReader reader, Map data, Iterable<String>? fields) {
}