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

io.permazen.change.ChangeSwitch Maven / Gradle / Ivy

The newest version!

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

package io.permazen.change;

/**
 * Visitor pattern interface for the {@link Change} class hierarchy.
 *
 * @param  method return type
 * @see Change#visit
 */
public interface ChangeSwitch {

    /**
     * Handle an {@link ObjectCreate} event.
     *
     * 

* The implementation in {@link ChangeSwitch} delegates to {@link #caseChange caseChange()}. * * @param change visiting change * @param changed object type * @return visitor return value */ default R caseObjectCreate(ObjectCreate change) { return this.caseChange(change); } /** * Handle an {@link ObjectDelete} event. * *

* The implementation in {@link ChangeSwitch} delegates to {@link #caseChange caseChange()}. * * @param change visiting change * @param changed object type * @return visitor return value */ default R caseObjectDelete(ObjectDelete change) { return this.caseChange(change); } /** * Handle a {@link ListFieldAdd} event. * *

* The implementation in {@link ChangeSwitch} delegates to {@link #caseListFieldChange caseListFieldChange()}. * * @param change visiting change * @param changed object type * @param changed list element type * @return visitor return value */ default R caseListFieldAdd(ListFieldAdd change) { return this.caseListFieldChange(change); } /** * Handle a {@link ListFieldClear} event. * *

* The implementation in {@link ChangeSwitch} delegates to {@link #caseListFieldChange caseListFieldChange()}. * * @param change visiting change * @param changed object type * @return visitor return value */ default R caseListFieldClear(ListFieldClear change) { return this.caseListFieldChange(change); } /** * Handle a {@link ListFieldRemove} event. * *

* The implementation in {@link ChangeSwitch} delegates to {@link #caseListFieldChange caseListFieldChange()}. * * @param change visiting change * @param changed object type * @param changed list element type * @return visitor return value */ default R caseListFieldRemove(ListFieldRemove change) { return this.caseListFieldChange(change); } /** * Handle a {@link ListFieldReplace} event. * *

* The implementation in {@link ChangeSwitch} delegates to {@link #caseListFieldChange caseListFieldChange()}. * * @param change visiting change * @param changed object type * @param changed list element type * @return visitor return value */ default R caseListFieldReplace(ListFieldReplace change) { return this.caseListFieldChange(change); } /** * Handle a {@link MapFieldAdd} event. * *

* The implementation in {@link ChangeSwitch} delegates to {@link #caseMapFieldChange caseMapFieldChange()}. * * @param change visiting change * @param changed object type * @param changed map key type * @param changed map value type * @return visitor return value */ default R caseMapFieldAdd(MapFieldAdd change) { return this.caseMapFieldChange(change); } /** * Handle a {@link MapFieldClear} event. * *

* The implementation in {@link ChangeSwitch} delegates to {@link #caseMapFieldChange caseMapFieldChange()}. * * @param change visiting change * @param changed object type * @return visitor return value */ default R caseMapFieldClear(MapFieldClear change) { return this.caseMapFieldChange(change); } /** * Handle a {@link MapFieldRemove} event. * *

* The implementation in {@link ChangeSwitch} delegates to {@link #caseMapFieldChange caseMapFieldChange()}. * * @param change visiting change * @param changed object type * @param changed map key type * @param changed map value type * @return visitor return value */ default R caseMapFieldRemove(MapFieldRemove change) { return this.caseMapFieldChange(change); } /** * Handle a {@link MapFieldReplace} event. * *

* The implementation in {@link ChangeSwitch} delegates to {@link #caseMapFieldChange caseMapFieldChange()}. * * @param change visiting change * @param changed object type * @param changed map key type * @param changed map value type * @return visitor return value */ default R caseMapFieldReplace(MapFieldReplace change) { return this.caseMapFieldChange(change); } /** * Handle a {@link SetFieldAdd} event. * *

* The implementation in {@link ChangeSwitch} delegates to {@link #caseSetFieldChange caseSetFieldChange()}. * * @param change visiting change * @param changed object type * @param changed set element type * @return visitor return value */ default R caseSetFieldAdd(SetFieldAdd change) { return this.caseSetFieldChange(change); } /** * Handle a {@link SetFieldClear} event. * *

* The implementation in {@link ChangeSwitch} delegates to {@link #caseSetFieldChange caseSetFieldChange()}. * * @param change visiting change * @param changed object type * @return visitor return value */ default R caseSetFieldClear(SetFieldClear change) { return this.caseSetFieldChange(change); } /** * Handle a {@link SetFieldRemove} event. * *

* The implementation in {@link ChangeSwitch} delegates to {@link #caseSetFieldChange caseSetFieldChange()}. * * @param change visiting change * @param changed object type * @param changed set element type * @return visitor return value */ default R caseSetFieldRemove(SetFieldRemove change) { return this.caseSetFieldChange(change); } /** * Handle a {@link SimpleFieldChange} event. * *

* The implementation in {@link ChangeSwitch} delegates to {@link #caseSetFieldChange caseFieldChange()}. * * @param change visiting change * @param changed object type * @param changed encoding * @return visitor return value */ default R caseSimpleFieldChange(SimpleFieldChange change) { return this.caseFieldChange(change); } // Roll-Up Methods /** * Visitor pattern roll-up method. * *

* The implementation in {@link ChangeSwitch} delegates to {@link #caseFieldChange caseFieldChange()}. * * @param change visiting change * @param changed object type * @return visitor return value */ default R caseListFieldChange(ListFieldChange change) { return this.caseFieldChange(change); } /** * Visitor pattern roll-up method. * *

* The implementation in {@link ChangeSwitch} delegates to {@link #caseFieldChange caseFieldChange()}. * * @param change visiting change * @param changed object type * @return visitor return value */ default R caseMapFieldChange(MapFieldChange change) { return this.caseFieldChange(change); } /** * Visitor pattern roll-up method. * *

* The implementation in {@link ChangeSwitch} delegates to {@link #caseFieldChange caseFieldChange()}. * * @param change visiting change * @param changed object type * @return visitor return value */ default R caseSetFieldChange(SetFieldChange change) { return this.caseFieldChange(change); } /** * Visitor pattern roll-up method. * *

* The implementation in {@link ChangeSwitch} delegates to {@link #caseChange caseChange()}. * * @param change visiting change * @param changed object type * @return visitor return value */ default R caseFieldChange(FieldChange change) { return this.caseChange(change); } /** * Visitor pattern roll-up method. * *

* The implementation in {@link ChangeSwitch} returns null. * * @param change visiting change * @param changed object type * @return visitor return value */ default R caseChange(Change change) { return null; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy