🟢Single file

Every single file model that is annotated as SingleFile annotation must have fileName and primarySection.

Every single file model must implement FileModel interface.

Methods: serialize() and deserialize(Map<String, Object> args) are important to Bukkit serialization system.

Example of Single file model:

@SingleFile(fileName = "users_coins.yml", primarySection = "users")
@SerializableAs("UserCoins") //This is alias for Bukkit serialization (optional)
public class UserCoins implements FileModel, ConfigurationSerializable {

    @Id
    private UUID uuid;
    private double coins;

    public UserCoins (String name, double coins) {
        this.name = name;
        this.coins = coins
    }
    
    @Override
    public Dao getDao() {
        return new SingleYamlFileDao(this);
    }
    
    @Override
    @NonNull
    public Map<String, Object> serialize() {
        Map<String, Object> data = new LinkedHashMap<>();

        data.put("uuid", uuid);
        data.put("coins", coins);

        return data;
    }

    public static UserCoins deserialize(Map<String, Object> args) {
        return new UserCoins((UUID) args.get("uuid"), 
        (double) args.get("coins"));
    }
}