deepdiff.core.DiffUnitProcessor Maven / Gradle / Ivy
/*
* Copyright 2011 DeepDiff Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package deepdiff.core;
/**
* Defines the interface for classes that wish to perform operations upon {@link DiffUnit}s. When a
* {@link DiffScope} finds a {@link DiffUnit}, it calls
* {@link #processDiffUnit(DiffUnit, DiffPointProcessor)} to allow it to be processed as needed.
*/
public interface DiffUnitProcessor {
/**
*
* Processes a single DiffUnit. Usually, this processing involves locating {@link DiffPoint}s in
* the unit, and passing them to the specified {@link DiffUnitProcessor}.
*
*
*
* Sometimes, a unit is best processed as a separate {@link DiffScope}. For example, it may be
* desirable to look at the entries within a Zip file instead of just treating it as a binary
* file. In this case, a new scope will be returned.
*
*
* @param diffUnit the DiffUnit to process
* @param processor the processor to apply to any DiffPoints found
*
* @return an additional scope to process, or null if none needed
*/
DiffScope processDiffUnit(DiffUnit diffUnit, DiffPointProcessor processor);
}