All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.permazen.core.FieldChangeNotifier Maven / Gradle / Ivy


/*
 * Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
 */

package io.permazen.core;

import java.util.NavigableSet;

abstract class FieldChangeNotifier {

    protected final Class listenerType;
    protected final int storageId;
    protected final ObjId id;

    FieldChangeNotifier(Class listenerType, int storageId, ObjId id) {
        assert listenerType != null;
        assert storageId > 0;
        assert id != null;
        this.listenerType = listenerType;
        this.storageId = storageId;
        this.id = id;
    }

    /**
     * Get the required listener type.
     */
    public Class getListenerType() {
        return this.listenerType;
    }

    /**
     * Get the storage ID of the field that chagned.
     */
    public int getStorageId() {
        return this.storageId;
    }

    /**
     * Get the ID of the object containing the field that chagned.
     */
    public ObjId getId() {
        return this.id;
    }

    /**
     * Notify the specified listener of the change.
     */
    public abstract void notify(Transaction tx, T listener, int[] path, NavigableSet referrers);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy